It is a puzzle game, where the player has to move the red block to blue position(exit). Green blocks are obstacles which may have to be moved to make room for the red block. Here, I have build two versions of it.
The game uses BFS algorithm to solve the puzzle in minimum steps. Each state is a configuration of the board.
visual.py is used for visualiztion in Linux shell.
The game uses BFS algorithm to solve the puzzle in minimum steps. Each state is a configuration of the board.
visual.py is a visualization file
It is a classic game. Here, Ghosts use BFS algorithm to eat Pacman. When Pacman eats a fruit, ghosts runs in a direction that maximizes its euclidean distance from the pacman (manhatten distance would be better).
pacmanBFS.py gives shortest path from ghosts to pacman.
escape.py gives the next position of ghosts to maximaize its distance from pacman
visualPac.py is for viusalization
pacmanMatrix is the input board configuration
Here, I have used q-learning to play above pacman game. The board of the game is reduced to 7x9, such that the total possible states is about 10^6.
train.py caluates the optimal decision.
Each time the file is run, the game is trained.