Sliding Puzzle - Solving Search Problem with Iterative Deepening A*

Demystifying Graph Traversal

Greg Surma
7 min readJan 28, 2019

In today’s article, we are going to solve Sliding Puzzle game with Iterative Deepening A* algorithm. In order to do so, we are going to disentangle this popular logic game and represent it as a Search Problem. By the end of this article, you will be able to implement search algorithms that can solve some of real-life problems represented as graphs.

Iterative Deepening A* Solver

Sliding Puzzle Game

Before we proceed to the core of this project, let’s begin with providing some info about a game which we will strive to solve.

A sliding puzzle, sliding block puzzle, or sliding tile puzzle is a combination puzzle that challenges a player to slide (frequently flat) pieces along certain routes (usually on a board) to establish a certain end-configuration. The pieces to be moved may consist of simple shapes, or they may be imprinted with colors, patterns, sections of a larger picture (like a jigsaw puzzle), numbers, or letters.

Rules of this game are very simple - we are sliding (←, →, ↑ , ↓) tiles to reach the final state in which all…

--

--

Responses (2)