|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A |
|
B |
|
C |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
D |
|
E |
|
F |
|
G |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
H |
|
I |
|
J |
|
K |
|
L |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
M |
|
N |
|
O |
|
P |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Q |
|
R |
|
S |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In this maze the exits/entrances are the triple coloured bars, green, yellow and magenta. Your path is defined by the sequence of those colours; ie, if you start at the top you may only enter a cell in the order of the cyclic sequence of G-Y-M (or the reverse order if you begin from below).
The object is to complete this maze, visiting each cell
at least once. While there is more than one route, the shortest routes are 31 and 34 letters. What are those routes?
Note: This has been modelled on the contribution of Chris Lusby Taylor at http://www.mathpuzzle.com/ , 26 Jul 2009.
I was considering an approach with backtracking, but had not got around to programming it. Charlie, I see that you have a nice working program!
However, my interpretation was that on first entering the maze at "B" one was entering through a GREEN , so that the next move would have to be a YELLOW, so it appeared to me that the first four moves would be B to A to D to E (green to B, yellow to A, magenta to D, and green to E) all forced.
I notice that after entering at B, you next moved to C or E or F (all show in your list) -- but all of those are crossing a consecutive GREEN. Perhaps brianjn will have to adjudicate if he meant to allow that (i.e. to ignore the color of the initial entry into B).
From the other end, clearly one exits from R by crossing a green wall, which would suggest to me that one had to enter that R from N as the only magenta path to R.
I assume one counts both the entry and the exit as moves, and since both are green that would mean 3x+1 total moves to keep up the color rotation (31 and 34 are such, which brianjn offers, suggesting he is counting greens at both end).
Perhaps I am missing a point in your approach, and in any case your code would probably handle a change regarding the entry and its constraints on the next move.