Maze (solitaire)

Maze is a Patience game using a deck of 52 playing cards. Despite the similarity in name, this game is different from the solitaire game of Labyrinth, and is more similar to the solitaire game of Gaps.

Rules
First, all 52 cards are laid out into a 6 x 9 grid, where the first two rows have 8 cards instead of 9. Then, the Kings are moved and discarded from play. This leaves six gaps, four left behind by the Kings and the two spaces formed on the first two rows.

The rule of the game are as follows:
 * A gap is filled by a card that is the same suit and a rank higher than the card on the gap's left or one that is the same suit and a rank lower than the card on the gap's right, whichever is more advantageous.
 * A gap to the right of a Queen can be filled with any ace or a card that is the same suit and a rank lower than the card on the gap's right, again, whichever is more advantageous. However, a gap to the left of an Ace is not filled.
 * The rows run from left to right, top to bottom.
 * The rows are continuous. The last card of one row is connected to the first card of the next. So goes with the last card of the sixth row to the first card of the first row. Thus, a gap on the extreme left of a row can be filled with a card with the same suit and a rank lower than the card on the gap's right or a card with the same suit and a rank higher than the last card of the row above, and vice versa.

The game is won when all 48 cards are arranged in four suit sequences from Ace to Queen with an Ace as the first card on the first row and a Queen as the last card of the sixth row; it does not matter where the gaps end up when this is achieved.