The HTML5 robot applet can be used to teach basic programming and maths.
Use this in your computer science or maths course to explain basic programming and geometry. Above all, let the students write or modify code for this!
A simple API is used for driving the robot around, which is perfect for teaching programming.
When having any walls, the robot can make arbitrary turns.