X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Fgameboard.py;h=5728d5d0f28535abfeadcbb5ab3f98c3a24b74b7;hb=7ffa20720668ad9e8701d0b5f98a2e3161132423;hp=123f3be6d6bf059187f4ac97357f306e613cf625;hpb=b3db4400695249420f5f941744c2a2692a1bad98;p=naja.git diff --git a/naja/gameboard.py b/naja/gameboard.py index 123f3be..5728d5d 100644 --- a/naja/gameboard.py +++ b/naja/gameboard.py @@ -1,6 +1,7 @@ from random import choice -from naja.constants import BITS, DIRECTION_BITS, CONDITION_BITS +from naja.constants import( + BITS, DIRECTION_BITS, CONDITION_BITS, PLAYER_DEFAULTS) from naja.player import Player from naja import actions @@ -20,7 +21,11 @@ class GameBoard(object): self.board_locations = board_locations @classmethod - def new_game(cls, max_health, wins_required, locations_definition): + def new_game(cls, locations_definition, + initial_bits=PLAYER_DEFAULTS.INITIAL_BITS, + initial_pos=PLAYER_DEFAULTS.INITIAL_POS, + max_health=PLAYER_DEFAULTS.MAX_HEALTH, + wins_required=PLAYER_DEFAULTS.WINS_REQUIRED): state = { 'max_health': max_health, 'health': max_health, @@ -28,7 +33,7 @@ class GameBoard(object): 'wins': 0, 'locations': locations_definition, } - player = Player(0x0f, (2, 2)) + player = Player(initial_bits, initial_pos) board_locations = cls.generate_board(locations_definition) return cls(state, player, board_locations)