diff options
author | pmoxhay <pmoxhay@earthlink.net> | 2009-06-13 19:03:42 (GMT) |
---|---|---|
committer | pmoxhay <pmoxhay@earthlink.net> | 2009-06-13 19:03:42 (GMT) |
commit | 8fc8e35fb962c4b86a0e48dd29bf094fc314f094 (patch) | |
tree | 5b4625f634e451f8c0bafc0fd752f7314a2a9855 | |
parent | b0612239a35254459bbf7d546b1d04e29900b738 (diff) |
Minor corrections to shapes and subshapes in cutting problems.
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | cuttingproblem.py | 30 |
2 files changed, 17 insertions, 16 deletions
@@ -7,6 +7,7 @@ General - Progress only when right answer is given (detect errors). - Fix bug: line segment drop area sometimes stays highlighted. + Fix bug: line segment drop targets incorrectly highlighted when moving by key press. ++ Restrain draggin of line segments, symbols not too far from drop targets. + Add sound effects. + Improve images of faucet, balance, scissors. + Animate pouring of water, maybe also cutting by scissors and motion of balance. @@ -24,5 +25,5 @@ Compare3 Lesson - Amount comparison: fit into answer box (maybe make wider and reposition). - Amount comparison: refine appearance of object groups. - Amount comparison: refine appearance of model (make pagelike). -+ Fix bug: length comparisons can give spurious correct result when lengths touch end-to-end, or overlap completely. +- Fix bug: length comparisons can give spurious correct result when lengths touch end-to-end, or overlap completely. diff --git a/cuttingproblem.py b/cuttingproblem.py index c77d997..2cc6e50 100644 --- a/cuttingproblem.py +++ b/cuttingproblem.py @@ -141,8 +141,8 @@ class CuttingProblem(Problem): LARGE_SQUARE_SHAPE = [ Vector(0, 0), Vector(250, 0), Vector(250, 250), Vector(0, 250) ] SMALL_SQUARE_SHAPE = [ Vector(0, 0), Vector(150, 0), Vector(150, 150), Vector(0, 150) ] RECTANGLE_SHAPE = [ Vector(0, 0), Vector(400, 0), Vector(400, 100), Vector(0, 100) ] - LARGE_RECTANGLE_SHAPE = [ Vector(0, 0), Vector(450, 0), Vector(450, 125), Vector(0, 125) ] - SMALL_RECTANGLE_SHAPE = [ Vector(0, 0), Vector(350, 0), Vector(350, 75), Vector(0, 75) ] + LARGE_RECTANGLE_SHAPE = [ Vector(0, 0), Vector(450, 0), Vector(450, 112.5), Vector(0, 112.5) ] + SMALL_RECTANGLE_SHAPE = [ Vector(0, 0), Vector(350, 0), Vector(350, 87.5), Vector(0, 87.5) ] TRIANGLE_SHAPE = [ Vector(0, 0), Vector(200, -200), Vector(400, 0) ] SMALL_TRIANGLE_SHAPE = [ Vector(0, 0), Vector(175, -175), Vector(350, 0) ] LARGE_TRIANGLE_SHAPE = [ Vector(0, 0), Vector(250, -250), Vector(500, 0) ] @@ -176,8 +176,8 @@ class CuttingProblem(Problem): # Uncomment to test a particular problem. #self.problem_number = 0 - self.sub_shapes1_points = [ ] - self.sub_shapes2_points = [ ] + self.sub_shapes1_points = [] + self.sub_shapes2_points = [] # Define the various problems. if self.problem_number == 0: @@ -210,13 +210,13 @@ class CuttingProblem(Problem): object2 = SMALL_RECTANGLE_SHAPE (original_position1, original_position2) = ( Vector (250, 250), Vector(500, 600) ) self.sub_shapes1_points = [ [ Vector(0, 0), Vector(100, 0), Vector(100, 200), Vector(0, 200) ], [ Vector(100, 0), Vector(200, 0), Vector(200, 200), Vector(100, 200) ] ] - self.sub_shapes2_points = [ [ Vector(0, 0), Vector(175, 0), Vector(175, 75), Vector(0, 75) ], [ Vector(175, 0), Vector(350, 0), Vector(350, 75), Vector(175, 75) ] ] + self.sub_shapes2_points = [ [ Vector(0, 0), Vector(175, 0), Vector(175, 87.5), Vector(0, 87.5) ], [ Vector(175, 0), Vector(350, 0), Vector(350, 87.5), Vector(175, 87.5) ] ] elif self.problem_number == 5: object1 = SQUARE_SHAPE object2 = LARGE_RECTANGLE_SHAPE (original_position1, original_position2) = ( Vector (250, 250), Vector(500, 600) ) self.sub_shapes1_points = [ [ Vector(0, 0), Vector(100, 0), Vector(100, 200), Vector(0, 200) ], [ Vector(100, 0), Vector(200, 0), Vector(200, 200), Vector(100, 200) ] ] - self.sub_shapes2_points = [ [ Vector(0, 0), Vector(225, 0), Vector(225, 125), Vector(0, 125) ], [ Vector(225, 0), Vector(450, 0), Vector(450, 125), Vector(225, 125) ] ] + self.sub_shapes2_points = [ [ Vector(0, 0), Vector(225, 0), Vector(225, 112.5), Vector(0, 112.5) ], [ Vector(225, 0), Vector(450, 0), Vector(450, 112.5), Vector(225, 112.5) ] ] elif self.problem_number == 6: object1 = PARALLELOGRAM_SHAPE @@ -242,19 +242,19 @@ class CuttingProblem(Problem): object2 = RECTANGLE_2_SHAPE (original_position1, original_position2) = ( Vector (250, 250), Vector(500, 600) ) self.sub_shapes1_points = [ [ Vector(0, 0), Vector(0, 150), Vector(-150, 150) ], [ Vector(0, 0), Vector(150, 0), Vector(300, 150), Vector(0, 150) ] ] - self.sub_shapes2_points = [ [ Vector(0, 0), Vector(150,0), Vector(300, 150), Vector(0, 150)], [ Vector(300, 150), Vector(150, 150), Vector(150, 0) ] ] + self.sub_shapes2_points = [ [ Vector(0, 0), Vector(150,0), Vector(300, 150), Vector(0, 150)], [ Vector(150, 0), Vector(300, 0), Vector(300, 150) ] ] elif self.problem_number == 10: object1 = TRAPEZOID_SHAPE object2 = LARGE_RECTANGLE_2_SHAPE (original_position1, original_position2) = ( Vector (250, 250), Vector(500, 600) ) self.sub_shapes1_points = [ [ Vector(0, 0), Vector(0, 150), Vector(-150, 150) ], [ Vector(0, 0), Vector(150, 0), Vector(300, 150), Vector(0, 150) ] ] - self.sub_shapes2_points = [ [ Vector(0, 0), Vector(175,0), Vector(350, 175), Vector(0, 175)], [ Vector(175, 0), Vector(350, 175), Vector(175, 175) ] ] + self.sub_shapes2_points = [ [ Vector(0, 0), Vector(175,0), Vector(350, 175), Vector(0, 175)], [ Vector(175, 0), Vector(350, 0), Vector(350, 175) ] ] elif self.problem_number == 11: object1 = TRAPEZOID_SHAPE object2 = SMALL_RECTANGLE_2_SHAPE (original_position1, original_position2) = ( Vector (250, 250), Vector(500, 600) ) self.sub_shapes1_points = [ [ Vector(0, 0), Vector(150, 0), Vector(300, 150), Vector(0, 150) ], [ Vector(0, 0), Vector(0, 150), Vector(-150, 150) ] ] - self.sub_shapes2_points = [ [ Vector(0, 0), Vector(125,0), Vector(250, 125), Vector(0, 125)], [ Vector(125, 0), Vector(250, 125), Vector(125, 125) ] ] + self.sub_shapes2_points = [ [ Vector(0, 0), Vector(125,0), Vector(250, 125), Vector(0, 125)], [ Vector(125, 0), Vector(250, 0), Vector(250, 125) ] ] else: object1 = SQUARE_SHAPE @@ -262,8 +262,8 @@ class CuttingProblem(Problem): (original_position1, original_position2) = ( Vector (250, 250), Vector(500, 600) ) self.sub_shapes1_points = [ [ Vector(0, 0), Vector(200, 0), Vector(0, 200) ], [ Vector(200, 0), Vector(200, 200), Vector(0, 200) ] ] self.sub_shapes2_points = [ [ Vector(0, 0), Vector(200, -200), Vector(200, 0) ], [ Vector(200, 0), Vector(200, -200), Vector(400, 0) ] ] - - # Switch the shapes half the time (so we get > as well as < problems). + + ## Switch the shapes half the time (so we get > as well as < problems). #if random.choice([0,1]) == 0: # self.shape1 = ShapeObject(color1, letter1, object1, original_position1, original_angle1) # self.shape2 = ShapeObject(color2, letter2, object2, original_position2, original_angle2) @@ -328,9 +328,9 @@ class CuttingProblem(Problem): def replace_by_sub_shapes1(self): #print "CuttingProblem: replace_by_sub_shapes1() called" #print " self.sub_shapes1_points =", self.sub_shapes1_points - self.sub_shape1_0 = ShapeObject(self.shape1.color, ' ', self.sub_shapes1_points[0], self.shape1.pos - Vector (100, 0), \ + self.sub_shape1_0 = ShapeObject(self.shape1.color, ' ', self.sub_shapes1_points[0], self.shape1.pos - Vector (150, 0), \ self.shape1.angle) - self.sub_shape1_1 = ShapeObject(self.shape1.color, ' ', self.sub_shapes1_points[1], self.shape1.pos + Vector (100, 0), \ + self.sub_shape1_1 = ShapeObject(self.shape1.color, ' ', self.sub_shapes1_points[1], self.shape1.pos + Vector (150, 0), \ self.shape1.angle) self.container.add_object(self.sub_shape1_0) self.container.add_object(self.sub_shape1_1) @@ -340,9 +340,9 @@ class CuttingProblem(Problem): def replace_by_sub_shapes2(self): #print "CuttingProblem: replace_by_sub_shapes2() called" #print " self.sub_shapes2_points =", self.sub_shapes2_points - self.sub_shape2_0 = ShapeObject(self.shape2.color, ' ', self.sub_shapes2_points[0], self.shape2.pos - Vector (100, 0), \ + self.sub_shape2_0 = ShapeObject(self.shape2.color, ' ', self.sub_shapes2_points[0], self.shape2.pos - Vector (150, 0), \ self.shape2.angle) - self.sub_shape2_1 = ShapeObject(self.shape2.color, ' ', self.sub_shapes2_points[1], self.shape2.pos + Vector (100, 0), \ + self.sub_shape2_1 = ShapeObject(self.shape2.color, ' ', self.sub_shapes2_points[1], self.shape2.pos + Vector (150, 0), \ self.shape2.angle) self.container.add_object(self.sub_shape2_0) self.container.add_object(self.sub_shape2_1) |