Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bounce.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-10-06 16:46:28 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-10-06 16:46:28 (GMT)
commit96342f8eda0bb30d475d2d07856ae46e5e30e773 (patch)
treeed5f4f7243b27b5a7d588c4ca907b09e3d949c28 /bounce.py
parent9c0579d3ecf3b3b04773b77022199480a0e13ff9 (diff)
added support for custom fractions
Diffstat (limited to 'bounce.py')
-rw-r--r--bounce.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/bounce.py b/bounce.py
index b0608bd..2575e16 100644
--- a/bounce.py
+++ b/bounce.py
@@ -382,6 +382,13 @@ class Bounce():
self.cells[cells[0]].move((0, self.height))
self.frame = cells[1]
+ def add_fraction(self, string):
+ ''' Add a new challenge; set bar to 2x demominator '''
+ numden = string.split('/', 2)
+ _logger.debug('adding (%s, %d) to the challenges',
+ string, int(numden[1]) * 2)
+ self.challenges.append((string, int(numden[1]) * 2))
+
def _choose_a_fraction(self):
''' Select a new fraction challenge from the table '''
n = int(uniform(0, len(self.challenges)))