From: Simon Cross Date: Sat, 17 May 2014 17:46:59 +0000 (+0200) Subject: Add parse_bits to utils. X-Git-Tag: 0.1~57 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=652ccba57669197aada1143ad0f61acb59578cd1;p=naja.git Add parse_bits to utils. --- diff --git a/naja/utils.py b/naja/utils.py index b15302a..d5d17cc 100644 --- a/naja/utils.py +++ b/naja/utils.py @@ -27,6 +27,11 @@ def move_glyph(move_name): }.get(move_name, move_name.lower()) +def parse_bits(bit_list): + # Convert names to numbers if applicable. + return frozenset(BITS.get(bit, bit) for bit in bit_list) + + def warp_to_game_state(game_state): from naja.events import LoadGameEvent, SceneChangeEvent from naja.scenes.game import GameScene