From bc80496f4c94c07e4ce636e7a2f7345c548f5374 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Fri, 16 May 2014 20:26:46 +0200 Subject: [PATCH] A (debug) way to start with more bits --- naja/constants.py | 2 ++ naja/gameboard.py | 3 +++ naja/options.py | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/naja/constants.py b/naja/constants.py index 424f65a..5442988 100644 --- a/naja/constants.py +++ b/naja/constants.py @@ -13,6 +13,8 @@ DEFAULTS = dict( debug=False, sound=True, music=True, + # Debug flags: + initial_bits=None, ) # Sound constants diff --git a/naja/gameboard.py b/naja/gameboard.py index bd4eb82..8b0e099 100644 --- a/naja/gameboard.py +++ b/naja/gameboard.py @@ -3,6 +3,7 @@ from random import choice from naja.constants import( BITS, DIRECTION_BITS, CONDITION_BITS, PLAYER_DEFAULTS, ACT, EXAMINE, ROTATION) +from naja.options import options from naja.player import Player from naja import actions @@ -28,6 +29,8 @@ class GameBoard(object): initial_pos=PLAYER_DEFAULTS.INITIAL_POS, max_health=PLAYER_DEFAULTS.MAX_HEALTH, wins_required=PLAYER_DEFAULTS.WINS_REQUIRED): + if options.initial_bits: + initial_bits = options.initial_bits state = { 'max_health': max_health, 'health': max_health, diff --git a/naja/options.py b/naja/options.py index 6e5f00d..e280b67 100644 --- a/naja/options.py +++ b/naja/options.py @@ -32,6 +32,10 @@ def parse_args(args): parser.add_option("--save-location", default=_get_default_save_location(), dest="save_location", help="Saved game location") + if options.debug: + parser.add_option('--initial-bits', type=int, + help='Initial player bits') + opts, _ = parser.parse_args(args) for k in DEFAULTS: -- 2.34.1