. Initialize the interface (drawing a grid, filling a grid image, etc)
2. Determine whether the game is over
{
Monitors user actions;
Preclick = NULL, curclick = NULL;
If (click a grid and the grid is not empty)
{
Preclick = curclick;
Curclick. Pos = this. (x, y );
}
If (preclick! = NULL & curclick! = NULL & preclick. PIC = curclick. PIC & (findpath (preclick, curclick) <a certain number )! = NULL)
{
Displays the line between two grids;
Thread. Sleep (a little time );
The two grids and connections disappear, and the playback of the disappears sound;
Score information;
Preclick = curclick = NULL;
}
// Automatically shuffling
If (findpath (distance between two grids <a number you specify) = NULL)
{
Initialize the remaining undeprecated grids at random;
}
}
Int numcount = 0;
3. prompt answer (limited number of times)
{
Onepos = NULL, twpos = NULL;
While (the game is not over)
{
If (findpath (distance between two grids <a number you specified )! = NULL)
{
Onepos. Pos = (x, y) of the First vertex );
Twopos. Pos = (x, y) of the second vertex );
Break;
}
}
Displays the line between two grids;
Thread. Sleep (a little time );
Disappears the line between two grids;
Numcount ++;
If (numcount> limited number of times)
{
Prompt;
Numcount = 0;
}
}
Int COUNT = 0;
4. Shuffling required (limited number of times)
{
If (the game is not over)
{
Initialize the remaining undeprecated grids at random;
Count ++;
}
If (count> limited number of times)
{
Prompt;
Count = 0;
}
}