From Heuristics

Jump to: navigation, search
Image:freecell.jpg Introduction

FreeCell is a game freely available on Windows and Unix. At the start of the game a deck of 52 cards is randomly placed in eight stacks: four stacks of seven cards and four stacks of eight cards. The goal of the game is to move all the cards to four goal cells on the top right: one stack per suit in ascending order starting with the ace. To do this you need to move cards on the board, a valid move means moving a card:

 1. to a FreeCell (top left) 
 2. to a GoalCell (top right) 
 3. on top of another card of one of the stacks

In case of move (2) a card may only be placed on the next card in sequence moving downward of the same suit (e.g. the jack of clubs must be placed on the 10 of clubs). In case of move (3) the card may only be placed on the next card in sequence moving upwards of a different colour (red/black), e.g. a black 4 may only be placed on a red 5. Similar to the rules of Solitaire.

Once a card has been moved to a GoalCell it may not be moved out again.

A provocative phrase from the manual is:

"It is thought, though not proven, that every game of FreeCell can be won." 

The best way to tackle this problem is to play a couple of games first to get a feeling for the game.

Source code by Patrick van Rietschoten:

In pdf-formaat

En in docx-formaat


The assignment is to write an algorithm which is able to move at least 8 cards to Goal Cells in a set of games of FreeCell


The advanced version of the assignment is to improve your algorithm to solve entire games of FreeCell from the starting position



Personal tools