A (debug) way to start with more bits
authorStefano Rivera <stefano@rivera.za.net>
Fri, 16 May 2014 18:26:46 +0000 (20:26 +0200)
committerStefano Rivera <stefano@rivera.za.net>
Fri, 16 May 2014 18:26:46 +0000 (20:26 +0200)
naja/constants.py
naja/gameboard.py
naja/options.py

index 424f65a0ec661563db51a6b8dd33f625b3d6ffb0..5442988373141ab227e144fae147d5fb7518bc39 100644 (file)
@@ -13,6 +13,8 @@ DEFAULTS = dict(
     debug=False,
     sound=True,
     music=True,
+    # Debug flags:
+    initial_bits=None,
 )
 
 # Sound constants
index bd4eb825c22e6f1bf1a7a686ee192eacf9474230..8b0e099a77da9ebe02d6d2f58d314aec1a8a9572 100644 (file)
@@ -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,
index 6e5f00d723be67c9e9ef5c15bc0666fe99b05b2e..e280b67773b9e0703cbf9f47fa6b7bfeb9cc60a3 100644 (file)
@@ -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: