In the tradiational computer science exercise, students are asked to explore the path between perfect states of this puzzle. That is, they are asked to get the tower from one post to another post, moving one disc at a time, without placing a larger disc on top of a smaller disc.
However, in this project, students find the optimal path between any two valid states of this puzzle. This involves graph theory, binomial expansion of integers, random numbers, Sierpinski triangles, user interface, and GUI writing. In some courses, I assign only the non-graphical version of this problem. I give the GUI version of this assignment in two parts. The GUI version includes a hint feature which makes an intelligent next-move for the user.
The heart of this assignment is the puzzle-state conversion process. There are four different representations of a given state of a puzzle which are used in this assignment. The student must understand the four representations and write functions/methods which convert between these four representations. One of these representations makes it quite easy to calculate distances between states.
Instructions for Part Two
GUI writing in Matlab
This lab is about steganography, the hiding of messages in plain sight! This is not "encryption" but students often view it this way. Students really love to manipulate sounds and photos in the computer, and this gives them a chance to do that. (It's easier to use photos than sounds, only because many of their favorite sound clips are copyrighted songs.)
This assignment starts by asking the students to go online and grab some freely distributed Matlab files which implement the common "LSB" (Least Significant Bits) Steganography algorithm. This allows them to immediately begin hiding and finding messages, while also acquainting them with freely available resources.
The second part of the assignment asks them to implement a steganography algorithm I wrote. In class, I emphasize that they can create their own algorithms for doing these things, and the fun part is not to try to make their system completely uncrackable, but rather to hide messages where nobody will be looking for them.
In this project, students are provided with several text files of words which are all identical except for the language they are in! (This works in theory, but most of the word lists were generated from Google translator, so this project is more for amusement than for actual serious study of a language. However, I did use it to help me prepare for my trip abroad one summer!)
When the project is run, the user is asked to choose two different languages, one for the question set, and another one for the answer set. So, for example, a user may choose to find the correct French word which corresponds to a given German word (or Italian, English, Spanish, or Piglatin).
Once the languages are chosen, the GUI is launched, and the user begins answering questions by clicking the appropriate radio buttons. User feedback is given. When the user is bored, the user may save the session and choose later to reopen an old session rather than start fresh. The program starts with a randomly generated itinerary which includes each question word once. If a question is answered incorrectly, the same question is inserted into the itinerary several more times to ensure the user learns that question. If the itinerary is finally completed successfully, the user is congratulated.
Some of the additional concepts in this lab include the generation of and use of random numbers. The student has to find a way to "seed" the random number generator in matlab so the user is not given the exact same question set each time the program is opened! Students have quite a bit of fun personalizing the GUI with photos, colors, and various methods of rewarding and punishing the users.
This project is broken down into three assignments.
Instructions for Part Two
Instructions for Part Three
I reserve this project for my more advanced course. The students create a small Computer-Aided Design GUI without using the Matlab GUI IDE (GUIDE), but they are given a small sample GUI which contains all the necessary commands and concepts they will need to use.
This GUI allows the user to move two control points around on the screen, thereby creating a parametric cubic using standard CAD formulas such as found in Gerald Farin's book and elsewhere.
Matlab calculates the curvature of this function as well as the derivative. If the derivative has no zeros, the resulting parametric cubic is a spiral.
Additionally, Matlab produces a diagram of this curve as it appears if used as the basis shape for a repeated structure as shown below. This is done to aid the human eye in its appreciation of the spiral shape, as this process will emphasize "corners" which may be present in the original cubic.
When Matlab detects that the user has found a spiral, colors of various plots change, giving the user immediate feedback about the curve. This can be a mesmerizing solitaire game of "see if you can find a new cubic spiral" for awhile.