Introduction
The puzzle
Overview
The Goal
Playing
The algorithm
Simple
Best solution
Search
Heuristic
Program Design
Search Classes
Extensions
Display
Download
Run
Comments
|
|
Finally, there are classes that
display the problem state and allow the user to attempt a solution:
| FifteenPanel: A class that displays the state
of the 15-puzzle as a 4 x 4 grid. It also allows the blocks to be
clicked by the user, in order to move the puzzle "manually". |
| Puzzle: This is the "main" class
that holds everything together. It can be run either as an applet or
as a stand-alone program (i.e. using main()). It creates a
screen, and uses a FifteenPanel as one component on that
screen. |
| ValidUserMoveEvent: An event that is raised by
the FifteenPanel to inform its container that a user has made a
valid "manual" move in the panel. |
| ValidUserMoveListener: Listens for a ValidUserMoveEvent.
In this version, it is implemented by the Puzzle class. In this
way, the Puzzle object can react to valid moves made and
reflected by the FifteenPanel object. |
|
|
|