updated parameters in yaml
authorDavid Sharpe <decoydavid@gmail.com>
Sat, 17 May 2014 12:58:54 +0000 (14:58 +0200)
committerDavid Sharpe <decoydavid@gmail.com>
Sat, 17 May 2014 12:58:54 +0000 (14:58 +0200)
data/location_decks/standard.yaml
naja/gameboard.py

index 14b2fbc8f186d7c8f0f6c6fc3dc7ca11a34a34d2..648e1587e8566db951647467c126f4c8f93d773d 100644 (file)
@@ -221,3 +221,8 @@ cards:
   - *SHIFT-W-BITSHIFT
   - *ROT-CW-AND-SET
   - *ROT-CCW-AND-SET
   - *SHIFT-W-BITSHIFT
   - *ROT-CW-AND-SET
   - *ROT-CCW-AND-SET
+
+replacement_params:
+  chance: 0.2
+  min: 5
+  max: 15
index ad692e716e8ee414371c72152f04ea0672233403..b827877b43d3bc530abc4bd3eb768fbba7de6b25 100644 (file)
@@ -361,7 +361,11 @@ class LocationCard(object):
         if replacement_params is None:
             return None
         else:
         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:
 
     def timer_action(self, position, board):
         if self.replacement_time is not None: