Use parse_bits from utils.
authorSimon Cross <hodgestar@gmail.com>
Sat, 17 May 2014 17:47:16 +0000 (19:47 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 17 May 2014 17:48:56 +0000 (19:48 +0200)
naja/gameboard.py

index 9855546c905a0a96019ecd60861132400cbbe7b6..ff65c2517e4d63c1a77ce46c1a21ec25661ec50f 100644 (file)
@@ -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),