A backtracking algorithm can be implemented to completely traverse the maze. Using the arrows, TuringKara can rememeber from which direction a field has been entered. If he reaches a field that has no way out, he markes it with a zero. Afterwards, he follows the arrows backwards until he finds a field from which he can take a different way and restart the search.
The states "WEST", "NORTH", "EAST" and "SOUTH" are used to check if the corresponding neighbouring fields are free und can be visited next. The actual backtracking is done in the state "BACK".