The Snake mission is great, but the provided test cases are lacking. Almost all of the posted solutions fail under some circumstances. Some of the solutions even fail (occasionally, depending on randomness) on a completely empty field with no obstacles.
To test my solution, I created a few additional cases that stress several tricky aspects of the game (as well as a few easy ones). I also ran most of the posted solutions against these tests.
TEST_CASES = ( ('trivial', [".........."] * 9 + ["..43210.C."]), ('easy', ["..T...T...", "C.T.......", "..T...TT..", "......T...", "..........", "...TT...T.", "....0T....", "....12T...", "..T..34T..", "....T....."]), ('wall', [".........."] * 4 + ["TTTT.TTTTT"] + [".........."] * 4 + [".43210..C."]), ('hard', ["......T...", ".C.T..T...", "...T.TT.T.", "..TT..T...", "TT......TT", "...TT.T...", ".T....T..4", "...TTTTTT3", "..T....012", "..T.....TT"]), ('evil', ["....T...TT", ".TT.C.T...", "....T...T.", "TTTTTTTTT.", "T.........", "T.TTTTTTT.", "T..4.TT...", "TTT32T..T.", "TT.01T....", "TT...TTTTT"]), )
At the very least, the 'hard' and 'evil' test cases should be added to the test suite, since very few solutions can pass these consistently. The 'wall' case is also interesting and causes some solutions trouble.
I'd also recommend running each solution multiple times. I didn't encounter some of the bugs in my solution until I played 1000 games. That's probably overkill, but 100 runs would probably flush out problems.