Thoughts on game connection

Source: Internet
Author: User

. 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;
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.