From: David Sharpe Date: Sat, 17 May 2014 12:58:54 +0000 (+0200) Subject: updated parameters in yaml X-Git-Tag: 0.1~94 X-Git-Url: https://git.ctpug.org.za/?p=naja.git;a=commitdiff_plain;h=2204be6c8019bb19cb8fe69192012aa7a74d36d7 updated parameters in yaml --- diff --git a/data/location_decks/standard.yaml b/data/location_decks/standard.yaml index 14b2fbc..648e158 100644 --- a/data/location_decks/standard.yaml +++ b/data/location_decks/standard.yaml @@ -221,3 +221,8 @@ cards: - *SHIFT-W-BITSHIFT - *ROT-CW-AND-SET - *ROT-CCW-AND-SET + +replacement_params: + chance: 0.2 + min: 5 + max: 15 diff --git a/naja/gameboard.py b/naja/gameboard.py index ad692e7..b827877 100644 --- a/naja/gameboard.py +++ b/naja/gameboard.py @@ -361,7 +361,11 @@ class LocationCard(object): if replacement_params is None: return None else: - return random.randint(replacement_params[0], replacement_params[1]) + if replacement_params['chance'] > random.random(): + return random.randint(replacement_params[0], + replacement_params[1]) + else: + return None def timer_action(self, position, board): if self.replacement_time is not None: