Gavin, mature reflection suggests to me that my assumptions ( 1 ) and ( 2 ) above are good assumptions, that make an interesting, challenging puzzle, but that ( 3 ) makes it impossible. ( 1 ) makes it possible to keep some information about each flag; ( 2 ) if you had infinite precision arithmetic, then one number could act as all of memory, large enough to contain a map of the entire maze, so restricting to finite sized numbers makes the puzzle interesting; ( 3 ) If the robot could leave breadcrumbs (Tremaux's algorithm, noted by DejMar), then you could imagine a strategy in which the robot uses the maze itself as the unbounded memory, tallying flags that have no breadcrumbs on them, and figuring out a way to determine that it has seen all of the boundary and all of the insides. So, did you somehow accidentally leave out one of the rules (I doubt it, as you a careful guy, but I can hope...), and the robot IS permitted to leave more than just a flag in a maze cell?