You Can play on your own(using WASD) or let ai play it using pathfinding or hamiltonian cycle. you can use pathfinding with BFS or A* algorithms (i didn't see it winning till now) or you can use hamiltonian cycle. Everytime you start the game it generates cycle using DFS.
- BFS
- Astar
- Hamiltonian Cycle