The Puzzle         

 
Introduction

The puzzle
Overview
The Goal
Playing

The algorithm
Simple
Best solution
Search
Heuristic

Program Design
Search Classes
Extensions
Display

Download

Run

Comments

 

Overview: The "15-puzzle" is a common children's toy. It consists of a square container. In this container, are placed 15 smaller square blocks. The length of each block is about 1/4th the length of the container. So, the container  can accommodate 4 rows of 4 blocks each (16 blocks in all).

The game comes with 15 blocks. These are numbered 1,2,3...and so on. The 16th place is left free.  It looks something like this:

The objective is to slide the blocks, one at a time until one has all the blocks organized in some fashion. For instance, a common goal is to try to organize the blocks so that the numbers are in ascending order, row by row, top to bottom.

The Goal:
.

How would one get from the "shuffled" state to the goal state?

Playing: Look at the shuffled state in the picture to the left. There are three possible moves:

  1. Move the "5" down; or,
  2. Move the "3" to the left; or,
  3. Move the "13" up

One might move the "5" down, then one might move the "1" to the left, so that it occupies top-left position, where you want it to be. Then, similarly, one might move the "2" to its final position, and so on.

Click, to play...

Technical info, for programmers...

Games and fun for everyone

There are many variations to the puzzle. Some have a picture on them, much like a jigsaw puzzle.

Other goal states may be attempted. However, certain goal states cannot be achieved from certain starting points.