Man-Machine game: a basic introduction to Ziqi game (I), man-machine

Source: Internet
Author: User

Man-Machine game: a basic introduction to Ziqi game (I), man-machine
(1) What is Ziqi?

Playing Ziqi is an entry-level chess for children to learn go. Its rules are partly taken from go, but it is much simpler than go.

(2) What are the rules for playing chess?

1. When playing a chess game, if a piece of chess is not played, it must be placed in a position that can hold the other piece tight.

2. When a piece of chess is in the beaten state, you can escape, instead of pressing the other piece.

3. Play chess. When a chess piece is promoted, the score is equal to or equal to the score.

4. There are two ways to win a game, that is, to eat and to eat in doubles.

5. For Ziqi, the start must be at tianyuan.

(3) Application Design Ideas

The general idea of designing this application is as follows:

DATA:

1. chessboard Representation

2. Representation of pawns

3. Calculate auxiliary data of chess pieces

AI:

1: generate the rule of playing chess (generate the rule of playing chess)

2: The core of valuation (the current idea is to analyze and count the two sides and take special measures to eat and levy Doubles)

3: excellent search engine (currently only narrow window search is used, an optimized alpha-beta Search)

UI:

Cocos2d-x 3.2

Draw a chessboard, chess piece, start interface, background, and so on.
(4) AI

Given the rules of playing chess, it is much easier to do AI. Aside from the question, currently, the AI of Go is mostly dual-random-Monte Carlo algorithms. If you are interested, you can study them.

1. Route generation:

It is easier to generate a method, because in most cases, each step requires the opponent's anger, while in a few cases, it can only survive. Therefore, there are few reasonable ways to do this in the middle of the year, games are rarely developed to a later stage.

2. Valuation core:

It is also relatively easy to judge the game surface, and abstract concepts such as region and potential do not need to be considered. These abstract concepts have not even found a good solution for current computer scientists. However, this part is very difficult to test, and many parameters need to be fine-tuned to detect changes in chess and board power. Determine the situation and win-or-lose for the leaf nodes that have not been mentioned. 1. It's my turn to win if the other party has a fight. 2. It's my turn to play, and the other party does not have a one-stop player, and I have two one-stop players, then I fail. 3. It's my turn to fight against the enemy. If I am not so angry, the other party can play two games. If I start to think about it, it is possible to eat and seek food in doubles. 4. In the same case, consider yourself. If we have only one chance to compete, consider whether we will be asked to eat it or not. 5. None of them appear. consider some additional parameters.

3. Search Engine: PVS. If you have performance requirements, consider using a replacement table.


Conclusion:

I once worked as a TA in a part-time go entry class and knew that it was a big task to accompany 4-5-year-old children to go, because they often get angry and naughty when playing chess. When children get started, they have to play chess. When they go home after class, they are accompanied by their parents. In addition, whether they win or lose, it is a big thing. However, all the parents say that they will not be angry and naughty when fighting against their computers.

As a result, I searched the internet to find out if I had any sub-game software, which left my parents away from the bitter sea. It also allowed my children to concentrate on playing chess instead of crying and playing naughty games, but I did not find it. It may be because of a small demand, generally, children can play GO games in the next week.

I am developing this game in my spare time. You are welcome to have a lot of discussions with Go fans and those who are interested in playing games.


Indicate the source for reprinting. Thank you.


I want to make a wuziqi game. I want to have a human-computer confrontation and ask how difficult it is to provide information.

It depends on how high the "IQ" of the machine you want to compete with. It should be difficult if it is at the same level as "Happy wuziqi. It is similar to building a very small database management software.

One-player game five-player game program I want to be more demanding

AI (I) of wuziqi)
Clicks: 2262 Release Date: 11:02:00
[Add to favorites] [comment] [print] [programmer Forum] [close]

Wuziqi Software Design Report
Hu Fengling, Hangzhou University of Electronic Science and Technology
In this compilation of the "wuziqi" program, only man-machine confrontation is compiled, and the game tree is used for search. The extremely small analytical method is used when the best steps are selected, considering the time complexity and space complexity of the search, only two steps of the search are performed in the program, that is, when the computer considers the next step, it only performs one-step speculation on the players. (The checkerboard specification in the program is 15*15)
The following describes the specific practices:
1. data structure definition:
Board definition: int board [15] [15];
On the 15*15 Board, there are 572 winning cases in total,
For example:
*****......
...... ...... ...... ...... ...... ......
...... ...... ...... ...... ...... ......
...... ...... ...... ...... ...... ......
...... ...... ...... ...... ...... ......
...... ...... ...... ...... ...... ......
The "*" in the first line represents a winning combination.
Combination of computers and players: bool ctable [15] [15] [572],
Bool ptable [15] [15] [572] indicates that all positions on the board are in the winning combination.
The number of pawns that a computer and a player fill in each winning combination. int win [2] [572]. If one party has five pawns in a winning combination, this party wins.
Bool player: whether it is the player's turn to play chess
Bool computer: whether it is the computer's turn to play chess
Bool start: whether the game starts
Bool pwin: whether the player wins
Bool cwin: whether the computer wins
CPoint m_pplastpos; // The player moves the previous step
CPoint m_pclastpos; // the previous step of the computer
To facilitate the description of the main algorithm of the program, we will first describe the selection method of the evaluation function in this program:
E = p1 + p2;
P1 is the score of the computer when the current game is completed; p2 is the score of the player when the current game is completed (p2 is actually negative). This takes into account the attack factor, the defense factor is taken into account in both aspects to prevent the computer from ignoring the attack only, and also prevent the computer from ignoring the attack only, so as to achieve a better situation.
2. Main process description
The program flowchart is as follows:

(1) initialize the checker: determine which party starts first, and (2) initialize the winning combination of the computer and the player.
Bool ctable [15] [15] [572], bool ptable [15] [15] [572]
Void CMyChessDlg: InitializeBoard ()
{
// At the beginning, both parties did not subscribe
Int I, j, count = 0, k;
M_pclastpos.x =-1;
M_pclastpos.y =-1;
M_pplastpos.x =-1;
M_pplastpos.y =-1;
Start = true;
// Determine which party starts first
If (m_bwfirst)
{
Player = false;
Computer = true;
}
Else
{
Player = true;
Computer = false;
... The remaining full text>
 

Related Article

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.