Add drugwars game
This commit is contained in:
14
main.py
14
main.py
@@ -49,6 +49,7 @@ KEY_SPACE = 32
|
|||||||
|
|
||||||
TIMEZONE_CALGARY = pytz.timezone('America/Edmonton')
|
TIMEZONE_CALGARY = pytz.timezone('America/Edmonton')
|
||||||
|
|
||||||
|
DRUGWARS_LOCATION = '/home/pi/protovac/env/bin/drugwars'
|
||||||
NETHACK_LOCATION = '/usr/games/nethack'
|
NETHACK_LOCATION = '/usr/games/nethack'
|
||||||
MORIA_LOCATION = '/usr/games/moria'
|
MORIA_LOCATION = '/usr/games/moria'
|
||||||
_2048_LOCATION = '/home/pi/2048-cli/2048'
|
_2048_LOCATION = '/home/pi/2048-cli/2048'
|
||||||
@@ -56,6 +57,7 @@ FROTZ_LOCATION = '/usr/games/frotz'
|
|||||||
HITCHHIKERS_LOCATION = '/home/pi/frotz/hhgg.z3'
|
HITCHHIKERS_LOCATION = '/home/pi/frotz/hhgg.z3'
|
||||||
SUDOKU_LOCATION = '/usr/games/nudoku'
|
SUDOKU_LOCATION = '/usr/games/nudoku'
|
||||||
|
|
||||||
|
HAS_DRUGWARS = os.path.isfile(DRUGWARS_LOCATION)
|
||||||
HAS_NETHACK = os.path.isfile(NETHACK_LOCATION)
|
HAS_NETHACK = os.path.isfile(NETHACK_LOCATION)
|
||||||
HAS_MORIA = os.path.isfile(MORIA_LOCATION)
|
HAS_MORIA = os.path.isfile(MORIA_LOCATION)
|
||||||
HAS_2048 = os.path.isfile(_2048_LOCATION)
|
HAS_2048 = os.path.isfile(_2048_LOCATION)
|
||||||
@@ -1168,6 +1170,8 @@ while True:
|
|||||||
stdscr.addstr(14, 4, '[H] Hitchhiker\'s Guide to the Galaxy', curses.A_REVERSE if highlight_keys else 0)
|
stdscr.addstr(14, 4, '[H] Hitchhiker\'s Guide to the Galaxy', curses.A_REVERSE if highlight_keys else 0)
|
||||||
if HAS_SUDOKU:
|
if HAS_SUDOKU:
|
||||||
stdscr.addstr(16, 4, '[S] Sudoku', curses.A_REVERSE if highlight_keys else 0)
|
stdscr.addstr(16, 4, '[S] Sudoku', curses.A_REVERSE if highlight_keys else 0)
|
||||||
|
if HAS_DRUGWARS:
|
||||||
|
stdscr.addstr(18, 4, '[D] Drugwars', curses.A_REVERSE if highlight_keys else 0)
|
||||||
|
|
||||||
stdscr.addstr(23, 1, '[B] Back', curses.A_REVERSE if highlight_keys else 0)
|
stdscr.addstr(23, 1, '[B] Back', curses.A_REVERSE if highlight_keys else 0)
|
||||||
|
|
||||||
@@ -1690,7 +1694,7 @@ I will be terse in my responses.
|
|||||||
stdscr.keypad(False)
|
stdscr.keypad(False)
|
||||||
curses.echo()
|
curses.echo()
|
||||||
curses.endwin()
|
curses.endwin()
|
||||||
logging.info('Spawning moria.')
|
logging.info('Spawning 2048.')
|
||||||
os.system(_2048_LOCATION)
|
os.system(_2048_LOCATION)
|
||||||
break
|
break
|
||||||
elif button == 'm' and HAS_MORIA:
|
elif button == 'm' and HAS_MORIA:
|
||||||
@@ -1709,6 +1713,14 @@ I will be terse in my responses.
|
|||||||
logging.info('Spawning nethack.')
|
logging.info('Spawning nethack.')
|
||||||
os.system(NETHACK_LOCATION)
|
os.system(NETHACK_LOCATION)
|
||||||
break
|
break
|
||||||
|
elif button == 'd' and HAS_DRUGWARS:
|
||||||
|
curses.nocbreak()
|
||||||
|
stdscr.keypad(False)
|
||||||
|
curses.echo()
|
||||||
|
curses.endwin()
|
||||||
|
logging.info('Spawning drugwars.')
|
||||||
|
os.system(DRUGWARS_LOCATION)
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
try_highlight()
|
try_highlight()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user