The realization of chess game

Source: Internet
Author: User

It's been a week. Finally, a simple chess game, but now only to entertain themselves, the next study of AI ...

Talk about your basic ideas.


1. Contains two large class chessboard class board and Chess class apices, Apices is abstract class, because different pieces have different rules of action, need to be implemented in the derived class;
2. Basic lines are implemented using GDI drawing, in order to facilitate the implementation of the Click event of the two classes are inherited sub panel;
3. How the Pieces Move:
First, define the checkerboard line intersection as the available point of the pawn, draw a rectangle with this point as the center, when the mouse clicks in this rectangle, decide whether to conform to the moving rules, determine whether to move the pieces to the corresponding coordinates;
4. How to eat a piece:
Determine whether the selected pieces and the current click on the coordinates of the pieces of the movement rules, the gun here is special, because his movement rules and eating sub-rules are not the same, need to be dealt with separately, the eaten pieces using visible false hidden, not really released;
5. Undo:
The use of stacks to store records, moving words to the beginning of the coordinates of the swap, eat the child's words need to be hidden before the pieces show out;


Interested friends can go here to download see, Common progress.

The realization of chess game

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.