Peg Game
written by Mark Overmars

Goal
The goal of this game is to remove all pegs (red balls in our case) except for one. You do this by jumping with one ball over the other. The ball in the middle disappears. In the easier level you can jump horizontal, vertical and diagonal. In the harder levels only horizontal and vertical jumps are allowed (you can see this by the 4 arrows in the right top corner).

Playing
To make a move, first click on the ball you want to move. It will get a thick black outline. Next click on the (empty) spot it has to go to. If it is a legal move the ball will move there and the ball in between will disappear.

Levels
The game has a number of levels. You can move between the levels with the arrows at the left top. You can restart the level using the green arrows. Try to add some levels yourself (and mail them to me).

Design
The only difficult part of this game is to determine whether a particular move is allowed. This is done in a piece of code in the mouse event of the hole. This piece of code is the heart of the whole game. Almost everything happens here. Actually, this game only uses code, to show you how everything can also be done using small pieces of code. The comment in the code indicates what the code does.