You can navigate the grid below from the top-left yellow circle to the bottom-right yellow square by making only orthogonal (not diagonal) moves, going from one position to the next only if the shape and/or the color of the shape in the entered cell is the same as that of the cell you are leaving.
-
What path has the minimum number of moves without going through the same cell twice?
-
What path has the maximum number of moves without going through the same cell twice?
In checking my graph, I found I erroneously joined 5,6 with 6,6; hence that route from 5,5 to 6,6 is excluded, but then the other is forced, ending with (5,5)(6,5)(6,6), so still max 26. I suppose this could be programmed, but with under a dozen routes, just inspection sufficed.