tanmay2004 / The-15-Puzzle

My implementation of the 15 puzzle game using the Pygame module with Python!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The-15-Puzzle

This is the 15 puzzle game I have created using the Pygame module with Python. The aim is to arrange the numbers in the correct order from 1 to 15 going row by row.

The initial board setup is chosen randomly by the program. This could produce unsolvable puzzles, which can be checked using an algorithm described in detail here and here. So, the program checks if the board position is an impossible one and randomly generates new ones until a valid starting position is obtained.

When you win, the 16th tile is automatically added to the board in its rightful place. The screenshot below is an example of the finished board you would see!

You will have to manipulate the tiles on the board into reaching the correct positions by making use of the empty white square. You can move the tiles adjacent to this tile into that place using the below two methods:

  • Clicking on the tile you wish to move
  • Using the 4 arrow keys

Note: You can switch between these controls at any point while playing the game.

About

My implementation of the 15 puzzle game using the Pygame module with Python!

License:MIT License


Languages

Language:Python 100.0%