Artificial Intelligence Project
Artificial Intelligence Project
SOKOBAN GAME
Project Members:
Midha Sohail (CS-18103)
Maham Akhlaq(CS-18083)
Zubia Naeem(CS-18010)
Syeda Haima Batool Naqvi(CS-18022)
INTRODUCTION:
Artificial Intelligence is becoming instrumental in a variety of applications. Games
serve as a good breeding ground for trying and testing these algorithms in a
sandbox with simpler constraints in comparison to real life. In this project, we aim
to develop an AI agent that can solve the classical Japanese game of Sokoban
using various algorithms and heuristics and compare their performances through
standard metrics. In this progress report, we delve deeper into the ideas
furnished is (1) pointing out the game mechanics in a straightforward manner (2)
describing the states and explaining how it is modeled in our algorithms (3)
detailing our algorithms to calculate the best moves for the levels of the game (4)
defining proper pruning techniques that are implemented to ameliorate the
performance of the algorithm (5) providing results and comparing the developed
algorithm using standard metrics of evaluation. We conclude with the next steps
we plan to take up to finish this project.
Scope:
Solving Sokoban is a NP-Hard problem, PSPACEComplete [1] and it has been an
active area of research. The branching factor of the Sokoban game is very high
and with each iteration, it has an exponential number of pushes and moves.
Therefore it needs proper heuristics that can help in eliminating redundant search
states. The backtracking algorithm limitations are evident when the size of the
puzzle is huge. Solving Sokoban has useful applications in robotics, especially
motion planning [4]. The robotic movement in a constrained space can be simpli
ed to Sokoban
1. General Game Mechanism:
Sokoban, literally referring to a warehouse keeper, was created by Hiroyuki
Imabayashi and is a cult classic. This game is a transportation puzzle where
the playing arena is composed of a grid of squares. Some of the squares are
marked as crates where the player has to push to a storage location in the
warehouse. Some of the squares are marked as walls which act as
constraints where the player as well as the crates cannot enter.
The initial state consists of a player at a certain x,y location on the grid and
certain locations marked as crates(or boxes) and target stores. The player
can move horizontally or vertically (four directions - Up, Down,Left and
Right). The player can push at most a single box into an empty space that is
not a wall or another box. The player is not allowed to pull the boxes too.
There are equal number of crates and target locations and the player
succeeds once all crates are in target storage locations. The player fails if a
crate gets locked up in a corner or with another crate with the storage
locations(or location) being unoccupied.
2. Literature Review:
From the literature study, we gather that the algorithm for solving this
highly popular transportation game is researched extensively and various
implementations have been formulated for quickly solving this problem
with better efficiency.
4. Algorithms:
Sokoban has many unique properties which are not there in other similar
problems as Rubiks cube or Lloyd Fifteen Puzzle. Moves are irreversible so
making a bad move can make you lose the game. Given the game
mechanics, several factors are taken into account for deciding on an
optimal algorithm: (1) There is a need for returning a set of moves quickly
because the game is played real time also. Consequently, an algorithm that
is able to produce moves in a short amount of processing time and returns
a strong move is desirable. (2) The constraint added to game. Constraints in
this game refers to the walls that are present inside the outer boundary
and restrict the path of the player. (3) The depth to which the search is
constructed. Since this search problem can lead to multitudes of states and
can at times lead to infinite search depths, once concern is to know how
much the algorithm can explore in the search space.
Given these considerations, we decided to evaluate considerable number
of algorithms and compare them based on their space/time complexities.
The strength of the algorithms in this space lies in their ability to quickly
determine sequences of moves that yield relatively strong results. We have
implemented four algorithms namely backtracking, Depth First Search
(DFS), Breadth First Search (BFS) and Uniform Cost Search (UCS) and shown
their results.
Hashing:
Hashing is a well known pruning method used to tune the algorithm
to perform better. It follows the logic that decision which leads to the
states that are already visited are considered as suboptimal. So all
the states are stored in the hash table and at each point, a
comparison is made between the current state and the stored state.
If there is a match, the same action corresponding to the one in the
hashing table is avoided.
5. Glimpse view of Sokoban:
6. CONCLUSION:
We have implemented many algorithms for developing an AI agent for
Sokoban game. We experimented with some of the pruning techniques and
observed that most of the algorithms were having similar moves in playing
the game but their performances differed in the time and the states
explored. Given a smaller dimension of level, A* algorithm with Hungarian
distance metric computed by Manhattan distance found to have better
performance than the other algorithms considered. But given a larger
dimensions of the level, all the algorithms are constrained by time and the
Convolutional Neural Network had fairly decent performance.
7. REFERENCES:
[1] Dor, Dorit, and Uri Zwick. ”SOKOBAN and other motion planning
problems.” Computational Geometry 13.4 (1999): 215-228. [2]
http://pavel.klavik.cz/projekty/solver/solver.pdf [3] Li, Zheng, et al.
”Object-oriented Sokoban solver: A serious game project for OOAD and AI
education.” Frontiers in Education Conference (FIE), 2014 IEEE. IEEE, 2014.
*4+ Taylor, Joshua, and Ian Parberry. ”Procedural generation of Sokoban
levels.” Proceedings of the International North American Conference on
Intelligent Games and Simulation. 2011