Skip to content

The Algorithm

NviCoder edited this page Jan 10, 2019 · 2 revisions

Algorithm

The algorithm based on BFS algorithm, using priority queue. So that the corners of the boxes are the nodes of the graph. Thus we knew to tell the player where he could go, so that for every available lane there was an arch between those nodes.

Node- green. Edges- red

image

The progress of the game:

Game start:

We have determined that the beginning of the game will be where the highest concentration of fruits.

image

image

Continue game:

The player will look for the closest node to him to be able to eat. And once he got to the fruit, he would see if there was any more fruit next to that fruit. This is how the player will continue until the fruit is eaten. Whether he ate them or the pacmans around him!. As we can see "B" is the option that is the best fot the player, despite "A".

image

Additionally, the player will always look to see if there is a ghost threatening him and try to escape to the side or up, if necessary.

image

In conclusion, the automated system we built will perform all the analyzes needed for the player, in order to reach all the fruits safely and quickly.

Hope you Enjoyed! Elad and yoav.

image