diff options
Diffstat (limited to 'volumeproblem.py')
-rw-r--r-- | volumeproblem.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/volumeproblem.py b/volumeproblem.py index d6a54ed..3299a2a 100644 --- a/volumeproblem.py +++ b/volumeproblem.py @@ -30,9 +30,12 @@ class VolumeProblem(Problem): Generates a problem in which two volumes are compared. """ - def __init__(self, container): + def __init__(self, container, (letter1, letter2) ): self.container = container + self.letter1 = letter1 + self.letter2 = letter2 + self.generate_problem() self.show_problem() @@ -51,11 +54,11 @@ class VolumeProblem(Problem): (Color.RED, Color.GREEN), (Color.GREEN, Color.RED), \ (Color.BLUE, Color.GREEN), (Color.GREEN, Color.BLUE)]) - # Choose two random letter to represent the two quantities - letter1 = random.choice(['A', 'B', 'C', 'D', 'G', 'H', 'K', 'L', 'M', 'N', 'P', 'S', 'T']) - letter2 = letter1 - while letter2 == letter1: - letter2 = random.choice(['A', 'B', 'C', 'D', 'G', 'H', 'K', 'L', 'M', 'N', 'P', 'S', 'T']) + ## Choose two random letter to represent the two quantities + #letter1 = random.choice(['A', 'B', 'C', 'D', 'G', 'H', 'K', 'L', 'M', 'N', 'P', 'S', 'T']) + #letter2 = letter1 + #while letter2 == letter1: + # letter2 = random.choice(['A', 'B', 'C', 'D', 'G', 'H', 'K', 'L', 'M', 'N', 'P', 'S', 'T']) # The total number of problems. n_problems = 3 @@ -246,11 +249,11 @@ class VolumeProblem(Problem): # Switch the shapes half the time (so we get > as well as < problems). if random.choice([0,1]) == 0: - self.shape1 = VolumeObject(color1, letter1, original_position1, self.height1, self.lower_radius1, self.upper_radius1) - self.shape2 = VolumeObject(color2, letter2, original_position2, self.height2, self.lower_radius2, self.upper_radius2) + self.shape1 = VolumeObject(color1, self.letter1, original_position1, self.height1, self.lower_radius1, self.upper_radius1) + self.shape2 = VolumeObject(color2, self.letter2, original_position2, self.height2, self.lower_radius2, self.upper_radius2) else: - self.shape1 = VolumeObject(color1, letter2, original_position1, self.height1, self.lower_radius1, self.upper_radius1) - self.shape2 = VolumeObject(color2, letter1, original_position2, self.height2, self.lower_radius2, self.upper_radius2) + self.shape1 = VolumeObject(color1, self.letter2, original_position1, self.height1, self.lower_radius1, self.upper_radius1) + self.shape2 = VolumeObject(color2, self.letter1, original_position2, self.height2, self.lower_radius2, self.upper_radius2) self.faucet_object = FaucetObject(Vector(0, 100)) self.container.add_object(self.faucet_object) |