I initially didn’t realize this was more a “very hard” than “hard” one, so tried it with the current language to achieve (Ruby, definitively not my favorite), but it became obvious that my knowledge of the perfs implication of the language + rather slow language to begin with wouldn’t allow me to get past the example.
My first C++ version (also a variation on A*, might try a real one to actually find the shortest sequence…) solved a bit more than half the random puzzles, and I reached 100% on try 4.
After a couple of improvements, all tests pass, except impossible of course, which still times out, apparently at 1/3 of the work needed to prove it impossible when checking locally.
The difference is that the “supermove” must be a composition of normal one-card moves. So they require at least one empty cell, either a free cell or an empty column, and more if you move more than two cards. Note that empty columns allow bigger moves, for instance three free cells allow moving a 4-card stack, but two free cells plus an empty column allow moving 6 cards.
Is the “impossible game” really impossible or is it just the name of the test? If it really is impossible, can I safely assume that there is no such impossible test in the validators?
What determines whether the referee automatically moves cards to the foundations after a move or not?
For example, in the first test case, why are moves 12 and 13 required?