Thursday, September 5, 2013

Flip Flop

Jennifer Silverman made this cool motions maze the other day. (More here.) We collaborated on it a little bit, after she did all the heavy lifting. I added buttons. (I may have a button problem.) It put me in mind of these motion puzzles I used to make in Geometer's Sketchpad, and I got to thinking how much better I could make them now. So I started, with the main new feature I wanted being the ability to generate new puzzles instead of being one static dynamic puzzle.

The user moves points A and B to try to find the line of reflection between the two flip flops. When you hit the Check button, it shows you the reflection over the line you're trying. 

What follows is my GeoGebra geek out over trying to make it look right. Here's the puzzle if you want to skip that: Flip Flop.

One thing I love about Jennifer's sketches are her excellent images. So I tried to step it up with some nice flip flops from

It turns out the trickiest part was getting both sandals to always show up. That's why I'm writing this post. (A lot of my individual sketches I post at the tumblr.) The key to being able to do this is that in the graphics window you can put variables in for the window dimensions. Define those from the objects in the sketch, and,  voilĂ , you can see both the sandals. So I defined xmin, xmax, ymin and ymax from the two sandals. E.g.,
xmin=floor(Min[{0, x(F1'), x(F2'), x(F3'), x(F4')}]) - 1
But there's a problem then - the graphics won't be in 1:1 scale, which is always nice, but especially important for motions where the two objects should look congruent!

The Corner[ ] command is my new best friend. Corner[n] for 1, 2, 3 & 4 return the coordinates of those corners. Corner[5] returns a point with (width, height). Corner[image name, number] returns the corners of an image. This was handy for finding the corners of the reflection, F1' etc. in the command above. 
So using Corner[5] I could find out the aspect ratio of the graphics window. It took me a few minutes, but I hit on the idea of making the bottom left corner steady, and then altering the top right corner based on the aspect ratio. I defined r = y(Corner[5])/x(Corner[5]) (so, height:width) and:
  • xm = If[(ymax - ymin) / (xmax - xmin) < r, xmax, xmin + (ymax - ymin) / r]
  • ym = If[(ymax - ymin) / (xmax - xmin) < r, ymin + r (xmax - xmin), ymax]
If the sandals give a screen that's not wide enough, it uses the aspect ratio to find a suitable width. If the sandals give a screen that's not tall enough, it uses the aspect ratio to find a good height. (The If[ ] command works like If[condition, then, else], where the else is optional.

The puzzle, as it turns out, is pretty challenging. Give it a try, and let me know what you think. Or let me know an easier better way to do my GeoGebra graphics hacking.

Here's the teacher page for download or the mobile page.

EDIT: Bonus! Jennifer created an assignment to give it more structure as a lesson. (PDF in dropbox.)


  1. Thanks for sharing the the aspect ratio issue. I am sure that will come in handy at some point.

    I like the flip flop activity - not so easy for me. Any thought to leaving the images of the incorrect attempts? Might be interesting to see how changing the line of reflection in an orderly way changes the image.

    The maze just seems like a normal paper maze except you use buttons instead of a pencil. Is there more to it?

  2. The flip flop was challenging for me, too. I once got to 11 tries!

    Incorrect images is an interesting idea. not sure how to do it off the top of my head. Maybe make a copy when check is pushed, then delete the list on new puzzle?It might wind up cloggin it up more. My hope for the current set up is that it will suggest to learners to study the image more.

    The original maze had students using the transformations to move. The point of the buttons to me would be to help familiarize students with the effect of the motions, and to start thinking of them from the perspective of the preimage instead of the observe. So Left Turn makes different directions depending on how you're facing.

  3. Sorry about the bum link! Here's the "lesson."

    Jen :)