1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 00:02:40 +01:00

[Wilds] Make "arc anoid" system requirements more accurate

Summary:
Fixes T8693. Ref T13098. On a 30x15 terminal, the we can only fit "Score: X/12 * Deaths: Y" on the top line if both `X` and `Y` are less than 10, so they can render with a single character.

As soon as the player breaks more than 9 blocks or dies more than 9 times, we need an extra character to render the score. This causes an off-screen write to curses and crashes.

Raise the minimum requirement to 32 columns so we can render "12/12" and up to "99" deaths. Then, change the display logic to show "99" if you die more than 99 times.

(At this resolution we always generate a board with 12 blocks, even if the terminal is very very tall, so we don't need to deal with a case where the "Score" might read "101/200".)

Test Plan:
- Beat the game on a 32x15 terminal.
- Changed logic to award me 1000 deaths per actual death.
- Died on a 32x15 terminal.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13098, T8693

Differential Revision: https://secure.phabricator.com/D20085
This commit is contained in:
epriestley 2019-02-02 05:18:42 -08:00
parent 01d31e291d
commit e9241dcb90
2 changed files with 29 additions and 20 deletions

View file

@ -141,11 +141,11 @@ def main(stdscr):
height, width = stdscr.getmaxyx()
if height < 15 or width < 30:
if height < 15 or width < 32:
raise PowerOverwhelmingException(
"Your computer is not powerful enough to run 'arc anoid'. "
"It must support at least 30 columns and 15 rows of next-gen "
"full-color 3D graphics.")
'Your computer is not powerful enough to run "arc anoid". '
'It must support at least 32 columns and 15 rows of next-gen '
'full-color 3D graphics.')
status = curses.newwin(1, width, 0, 0)
height -= 1
@ -194,7 +194,15 @@ def main(stdscr):
status.addstr('%s/%s ' % (Block.killed, Block.total), curses.A_BOLD)
status.addch(curses.ACS_VLINE)
status.addstr(' DEATHS: ', curses.A_BOLD | curses.color_pair(4))
status.addstr('%s ' % Ball.killed, curses.A_BOLD)
# See T8693. At the minimum display size, we only have room to render
# two characters for the death count, so just display "99" if the
# player has more than 99 deaths.
display_deaths = Ball.killed
if (display_deaths > 99):
display_deaths = 99
status.addstr('%s ' % display_deaths, curses.A_BOLD)
status.addch(curses.ACS_LTEE)
if Block.killed == Block.total:

View file

@ -1,29 +1,30 @@
<?php
final class ArcanistAnoidWorkflow extends ArcanistWorkflow {
final class ArcanistAnoidWorkflow
extends ArcanistWorkflow {
public function getWorkflowName() {
return 'anoid';
}
public function getCommandSynopses() {
return phutil_console_format(<<<EOTEXT
**anoid**
EOTEXT
);
public function getWorkflowInformation() {
$help = pht(
'Use your skills as a starship pilot to escape from the Arcanoid. '.
'System requirements: a color TTY with character resolution 32x15 or '.
'greater.');
return $this->newWorkflowInformation()
->setHelp($help);
}
public function getCommandHelp() {
return phutil_console_format(<<<EOTEXT
There's only one way to find out...
EOTEXT
);
public function getWorkflowArguments() {
return array();
}
public function run() {
phutil_passthru(
'%s/scripts/breakout.py',
dirname(phutil_get_library_root('arcanist')));
public function runWorkflow() {
$root_path = dirname(phutil_get_library_root('arcanist'));
$game_path = $root_path.'/scripts/breakout.py';
return phutil_passthru('%s', $game_path);
}
}