Just to enhance my java script skills i am trying to develop a pacman game in js. have a grid of 20 by 20 . This grid has 0's and 1's which indicate if there is a wall or a path . Now I want to develop a algo for the demons to follow the pacman . I am not sure which algorithm should I go for .
So my input to the function will be foo( current position, pacman position,grid, path)
var maze = [ [0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0],
[0,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,0],
[0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0],
[0,1,0,1,0,1,1,1,1,0,0,1,1,1,1,0,1,0,1,0],
[0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,0],
[0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,0],
[0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0],
[0,1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,1,1,0],
[0,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,1,0],
[0,1,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,0,1,0],
[1,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,1],
[0,1,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,1,0],
[0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,0],
[0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0],
[0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,0],
[0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,0],
[0,1,0,1,0,1,1,1,1,0,0,1,1,1,1,0,1,0,1,0],
[0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0],
[0,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,0],
[0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0]];