when i'm on the first lvl. hitting Restart (R) it restarts 2 different path.
as far as how you could handle the undo and whatnot.
The player grid: have you tried setting up an array to match the grid. and set each position to "false" and if touch is over the a specific grid which matches the array position set it to "true" and then add the green tile. and if you touch over the green tile it'll change back to false and remove the green tile.
while checking if player array matches with the solution array.