Lines: A Game of Strategy

Konstantin Lukin (klukin77@gmail.com) and Yevgeniy Miretskiy

Project Java Webmaster: Glenn A. Richard
Mineral Physics Institute
SUNY Stony Brook



How to Use this Applet

Try to get as many points as you can by lining up the colored balls in rows, columns, or diagonals of five or more, all of the same color. You can activate a ball by clicking on it, and deactivate it by clicking on it again. You can move a ball that you have activated by clicking on a destination square for it. However, the ball will only move if there is a clear path to its destination. A clear path consists of empty squares that are horizontally or vertically adjacent. The system uses a breadth-first search to determine whether the path you have chosen for moving the ball is actually clear.

When you move a ball that completes a line of five or more, all the balls in that line disappear and you receive points. For a line of five, ten points are awarded. For more than five, you receive ten points, plus two raised to the n-5 power, where n is the number of balls in the line.

Note the rack on top that contains three balls. After you move a ball without completing a line, the three balls from the rack are moved onto the field in randomly-chosen locations. The contents of the rack are refreshed with balls of randomly-chosen colors.

The game ends when the field is completely filled, preventing any additional moves on your part.

Mathematical Concepts

Source Code


Konstantin Lukin: klukin77@gmail.com
Yevgeniy Miretskiy: eugene@invision.net

[More Applets: Project Java Home]