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
@classmethod
def import_game(cls, definition):
board_locations = [
[(i % 5, i // 5),
LocationCard.new_location(
- card.copy(), replacement_params).export()]
+ card.copy(), replacement_params, puzzle=True).export()]
for i, card in enumerate(deck['cards'])
]
return board_locations
"""
def __init__(self, card_name, bitwise_operand, location_actions,
- replacement_time, max_number=25):
+ replacement_time=None, max_number=25):
self.card_name = card_name
self.bitwise_operand = bitwise_operand
self.actions = location_actions
self.max_number = max_number
- self.check_actions()
self.replacement_time = replacement_time
@classmethod
return action_class(required_bits, **data)
@classmethod
- def new_location(cls, definition, replacement_params):
+ def new_location(cls, definition, replacement_params=None, puzzle=False):
if 'bits' in definition:
bits = cls.parse_bits(definition['bits'])
else:
max_number = definition.get('max_number', 25)
card_name = definition['card_name']
- return cls.import_location({
+ location = cls.import_location({
'bitwise_operand': bits,
'actions': definition['actions'],
'max_number': max_number,
'card_name': card_name,
'replacement_time': replacement_time,
})
+ if not puzzle:
+ location.check_actions()
+ return location
@classmethod
def parse_bits(self, bit_list):