Report For Sokoban
Report For Sokoban
March 2021
The game shall meet its end once all the boxes are put into their correct places (the goals, in others
way).
The state space of the game is the position of the Sokoban itself and the position of the boxes.
There are four legal actions in the game of Sokoban, which are go up, go down, go left and go right.
However, for a more details saying, let us consider the game has totally 8 legal actions, which are go left,
go right, go up, go down and interact with the boxes
The successor function of this game is defined as the location of Sokoban after taking one legal actions
from the action space, or the position of both Sokoban and the box in the event of Sokoban’s choice to
push the boxes.
DFS algorithm takes the idea of backtracking, it involves exhaustive searches of all the node by moving
forward, else by backtracking. The advantage of using DFS in this modelized game is that the answer
might be found quickly, it does not guarantee the quality, despite. And a foreseen consequence for using
this algorithm as the solution is that the answer is unnecessary long, even if for just a simple test. And
I shall clarify this comment in the sections below.
When constructing the algorithm, I utilize the code of DFS given previously with a micro change,
in which I change the deque from pop (here its mean pop the rightmost element) into pop the leftmost
element in the deque. This is due to the basic difference between two different concepts of DFS and BFS.
The answer given by BFS algorithm is by far better than DFS significantly, where it fixes the draw-
backs of the DFS algorithm - unnecessarily long answers for a simple state.
1
In details, we might pick a certain map in the game and let us take a closer look for a detailed effi-
ciency between DFS and BFS - map 3. The map is described as below:
On the contrary, despite the major efficiency in the algorithm of breadth first search algorithm, it
is still not able to solve map 5, which might be the most difficult map in the game. That is, thus, the
reason for why we have the third path finding algorithm.
The main idea behind the concept of Uniform cost search (UCS) algorithm is to compute the past
costs in order of increasing past cost. To make this efficient, we need to make an important assumption
that all action costs are non-negative. UCS and Dijikstra’s algorithm has many similarities, however,
UCS algorithm takes input as a search problem, which implicitly defines a large and even infinite graph,
whereas Dijkstra’s algorithm (in the typical exposition) takes as input a fully concrete graph.
The clearest evidence for the surpassing power of this algorithm is to give it through one hard prob-
lem, which can not be solved easily by 2 others algorithms: BFS and DFS.
Surprisingly, uniform cost search solves it without a doubt, within just a little time to take: 63 seconds
in details in Intel@Corei5 processor. What is more, the solution given by UCS share the similarities with
the BFS, but with a faster time to take.
Hence, it is clear to tell that Uniform cost search is by far the best path-finding algorithm among the
others, which are depth-first search and breadth-first search.