from naja.player import Player
from naja import actions
from naja.sound import sound
+from naja.utils import parse_bits
import random
@classmethod
def build_action(cls, definition):
action_class = getattr(actions, definition['action_class'])
- required_bits = cls.parse_bits(definition['required_bits'])
+ required_bits = parse_bits(definition['required_bits'])
data = definition.get('data', {})
return action_class(required_bits, **data)
@classmethod
def new_location(cls, definition, replacement_params=None, puzzle=False):
if 'bits' in definition:
- bits = cls.parse_bits(definition['bits'])
+ bits = parse_bits(definition['bits'])
else:
bits = cls.generate_bitwise_operand()
location.check_actions()
return location
- @classmethod
- def parse_bits(self, bit_list):
- # Convert names to numbers if applicable.
- return frozenset(BITS.get(bit, bit) for bit in bit_list)
-
def export(self):
return {
'bitwise_operand': sorted(self.bitwise_operand),