mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-28 17:52:42 +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:
parent
01d31e291d
commit
e9241dcb90
2 changed files with 29 additions and 20 deletions
|
@ -141,11 +141,11 @@ def main(stdscr):
|
||||||
|
|
||||||
height, width = stdscr.getmaxyx()
|
height, width = stdscr.getmaxyx()
|
||||||
|
|
||||||
if height < 15 or width < 30:
|
if height < 15 or width < 32:
|
||||||
raise PowerOverwhelmingException(
|
raise PowerOverwhelmingException(
|
||||||
"Your computer is not powerful enough to run 'arc anoid'. "
|
'Your computer is not powerful enough to run "arc anoid". '
|
||||||
"It must support at least 30 columns and 15 rows of next-gen "
|
'It must support at least 32 columns and 15 rows of next-gen '
|
||||||
"full-color 3D graphics.")
|
'full-color 3D graphics.')
|
||||||
|
|
||||||
status = curses.newwin(1, width, 0, 0)
|
status = curses.newwin(1, width, 0, 0)
|
||||||
height -= 1
|
height -= 1
|
||||||
|
@ -194,7 +194,15 @@ def main(stdscr):
|
||||||
status.addstr('%s/%s ' % (Block.killed, Block.total), curses.A_BOLD)
|
status.addstr('%s/%s ' % (Block.killed, Block.total), curses.A_BOLD)
|
||||||
status.addch(curses.ACS_VLINE)
|
status.addch(curses.ACS_VLINE)
|
||||||
status.addstr(' DEATHS: ', curses.A_BOLD | curses.color_pair(4))
|
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)
|
status.addch(curses.ACS_LTEE)
|
||||||
|
|
||||||
if Block.killed == Block.total:
|
if Block.killed == Block.total:
|
||||||
|
|
|
@ -1,29 +1,30 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class ArcanistAnoidWorkflow extends ArcanistWorkflow {
|
final class ArcanistAnoidWorkflow
|
||||||
|
extends ArcanistWorkflow {
|
||||||
|
|
||||||
public function getWorkflowName() {
|
public function getWorkflowName() {
|
||||||
return 'anoid';
|
return 'anoid';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCommandSynopses() {
|
public function getWorkflowInformation() {
|
||||||
return phutil_console_format(<<<EOTEXT
|
$help = pht(
|
||||||
**anoid**
|
'Use your skills as a starship pilot to escape from the Arcanoid. '.
|
||||||
EOTEXT
|
'System requirements: a color TTY with character resolution 32x15 or '.
|
||||||
);
|
'greater.');
|
||||||
|
|
||||||
|
return $this->newWorkflowInformation()
|
||||||
|
->setHelp($help);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCommandHelp() {
|
public function getWorkflowArguments() {
|
||||||
return phutil_console_format(<<<EOTEXT
|
return array();
|
||||||
There's only one way to find out...
|
|
||||||
EOTEXT
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run() {
|
public function runWorkflow() {
|
||||||
phutil_passthru(
|
$root_path = dirname(phutil_get_library_root('arcanist'));
|
||||||
'%s/scripts/breakout.py',
|
$game_path = $root_path.'/scripts/breakout.py';
|
||||||
dirname(phutil_get_library_root('arcanist')));
|
return phutil_passthru('%s', $game_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue