I'm a beginner at prolog and I'm trying to make pacman move by itself using netlogo and prolog. So this is part of my code:
walkfront(_,_,_,_,_,_,Pacman,DirP,Lab,Ghost,_,Pellet,_,_,Decision) :-
findall(Dir,
( member(Dir,[0,90,180,270]),
\+ ( member((G,false),Ghost), dangerous(Pacman,G,2,Dir,_) ) ),
L),
findall(Dir,(member(Dir,[0,90,180,270]),(member(P,Pellet))),T),
chooseNotDangerous(L,Pacman,DirP,Lab,Dir,T)
walkfront(_,_,_,_,_,_,Pacman,DirP,Lab,Ghost,_,Pellet,_,_,Decision)
this line has all the lists of information I'm getting from netlogo, Pacman has the position of pacman (x,y), DirP is the direction pacman is facing, Lab is the free spaces in the maze, Ghost is the position of the ghosts (x,y,eaten?), Pellet is a list of all the positions of the pellets (x,y), Decision is the output choosen by pacman.
The first findall is supposed to give me all the directions (Dir) that don't have ghosts and that aren't dangerous and save them in a list called L.
The second findall, I wanted it to give me all the directions that have pellets and save them in a list called T.
My question is if this findall's are correct because my code isn't working for some reason and I think it might be beacause of the second findall.
Thank you for helping me :).