From 2204be6c8019bb19cb8fe69192012aa7a74d36d7 Mon Sep 17 00:00:00 2001 From: David Sharpe Date: Sat, 17 May 2014 14:58:54 +0200 Subject: [PATCH] updated parameters in yaml --- data/location_decks/standard.yaml | 5 +++++ naja/gameboard.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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: -- 2.34.1