Ok, I understand it now. No, the question was because I thought you directly put "walls[x, y] = true" when you modified the map, which would make it harder to roll back (a friend of mine tried that, it caused quite a few headaches). But talking about expensive code, my code made a clone of the map at each iteration, not exactly free either, but that meant I didn't have any bugs related to movement and that the minimax was entirely recursive.
About the ranking, you never know what will happen during the final tournament

@timwintle:
Isn't that what minimax is supposed to do for you? The algorithm returns you the best move you can make against a perfect opponent, which means that if the enemy doesn't do what you thought he'd do, it's a worse move for him, giving you an advantage. If you do another move, you're basically hoping your opponent makes a mistake, which isn't the best thing to do.