puzzle_defaults = deck.get('defaults', {})
for k, v in puzzle_defaults.iteritems():
if isinstance(v, list):
puzzle_defaults = deck.get('defaults', {})
for k, v in puzzle_defaults.iteritems():
if isinstance(v, list):
player = Player(initial_bits, initial_pos)
board_locations = cls.import_board_locations(
cls.generate_board(deck))
player = Player(initial_bits, initial_pos)
board_locations = cls.import_board_locations(
cls.generate_board(deck))
- return cls(state, player, board_locations)
+ board = cls(state, player, board_locations)
+ player.set_gameboard(board)
+ return board
player = Player.import_player(state.pop('player'))
board_locations = cls.import_board_locations(
state.pop('board_locations'))
player = Player.import_player(state.pop('player'))
board_locations = cls.import_board_locations(
state.pop('board_locations'))
- return cls(state, player, board_locations)
+ board = cls(state, player, board_locations)
+ player.set_gameboard(board)
+ return board
"""
def __init__(self, card_name, bitwise_operand, location_actions,
"""
def __init__(self, card_name, bitwise_operand, location_actions,
self.card_name = card_name
self.bitwise_operand = bitwise_operand
self.actions = location_actions
self.max_number = max_number
self.card_name = card_name
self.bitwise_operand = bitwise_operand
self.actions = location_actions
self.max_number = max_number
@classmethod
def build_action(cls, definition):
action_class = getattr(actions, definition['action_class'])
@classmethod
def build_action(cls, definition):
action_class = getattr(actions, definition['action_class'])
data = definition.get('data', {})
return action_class(required_bits, **data)
@classmethod
data = definition.get('data', {})
return action_class(required_bits, **data)
@classmethod
- def new_location(cls, definition, replacement_params):
+ def new_location(cls, definition, replacement_params=None, puzzle=False):
max_number = definition.get('max_number', 25)
card_name = definition['card_name']
max_number = definition.get('max_number', 25)
card_name = definition['card_name']
'bitwise_operand': bits,
'actions': definition['actions'],
'max_number': max_number,
'card_name': card_name,
'replacement_time': replacement_time,
})
'bitwise_operand': bits,
'actions': definition['actions'],
'max_number': max_number,
'card_name': card_name,
'replacement_time': replacement_time,
})
-
- @classmethod
- def parse_bits(self, bit_list):
- # Convert names to numbers if applicable.
- return frozenset(BITS.get(bit, bit) for bit in bit_list)
+ if not puzzle:
+ location.check_actions()
+ return location