[Community Puzzle] FreeCell

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.

2 Likes

In the example game, the move 76 with the below game state qualifies as a supermove (2 cards move):
image

However, when I try to play 65 with the below game state, it does NOT qualify as a supermove (4 cards don’t move). What is the difference?

image

image

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.

1 Like

Thanks Lanfeust, very helpful. I realize now I completely misunderstood the concept of a supermove.

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?

Yes it is really impossible. The validators are all, uh, possible.

Thank you Mrs. GloriaZindlebock.

AFAIK, it’s merely “never been shown to be solvable”.

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?

26 76 72 72 5a 27 57 67 1b 61 41 4h 4h 41 45 34 3c 6d 5b

It seems to works fine if you automove all aces and twos, or if card <= 1+max(cards of other color in foundation)