From: Simon Cross Date: Sat, 17 May 2014 17:47:16 +0000 (+0200) Subject: Use parse_bits from utils. X-Git-Tag: 0.1~56 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=e5731d2cbc0c7a260e7b69aac07e6c26b9b2c56d;p=naja.git Use parse_bits from utils. --- diff --git a/naja/gameboard.py b/naja/gameboard.py index 9855546..ff65c25 100644 --- a/naja/gameboard.py +++ b/naja/gameboard.py @@ -7,6 +7,7 @@ from naja.options import options from naja.player import Player from naja import actions from naja.sound import sound +from naja.utils import parse_bits import random @@ -315,14 +316,14 @@ class LocationCard(object): @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() @@ -345,11 +346,6 @@ class LocationCard(object): 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),