I'm wondering how to run BFS algorithm for rubik cube that is an input parameter of my function. So far I have created functions rotateUp(cubeIn, cubeOut), rotateDown(cubeIn, cubeOut2), rotateFront(cubeIn, cubeOut), rotateBack(cubeIn, cubeOut), rotateLeft(cubeIn, cubeOut), rotateRight(cubeIn, cubeOut)
to rotate every single side of rubik cube.
Now I'm about to run some recursive function, where I can rotate my cube every possible way and then chceck if rubik cube is solved.
I already tried this solution but its going only deeper and deeper:
bfs(cubeIn) :-
rotateUp(cubeIn, cubeOut1), bfs(cubeOut1),
rotateDown(cubeIn, cubeOut2), bfs(cubeOut2),
rotateFront(cubeIn, cubeOut3), bfs(cubeOut3),
rotateBack(cubeIn, cubeOut4), bfs(cubeOut4),
rotateLeft(cubeIn, cubeOut5), bfs(cubeOut5),
rotateRight(cubeIn, cubeOut6), bfs(cubeOut6).
So I wanted to implement BFS algorithm for my rubik cube issue and I made this one:
bfs(cubeIn) :-
rotateUp(cubeIn, cubeOut1),
rotateDown(cubeIn, cubeOut2),
rotateFront(cubeIn, cubeOut3),
rotateBack(cubeIn, cubeOut4),
rotateLeft(cubeIn, cubeOut5),
rotateRight(cubeIn, cubeOut6),
bfs(cubeOut1),bfs(cubeOut2),bfs(cubeOut3),
bfs(cubeOut4),bfs(cubeOut5),bfs(cubeOut6).
But in the end it is still not working like BFS. Don't you have any idea what I'm doing wrong there?