First, the operation of the program
Second, the computer in this program has the function of automatic judgment, according to the layout of the current pieces of the relevant way to use. In order to avoid the screen flashing at the time of walk, using double buffering for drawing output, the following is part of the software implementation code:
#include "stdafx.h"
The following data structures are defined in the Cfivechessview class:
enum {max_x = max_y=18, min_x =1, min_y = 1};
NONE: Empty location: Black White
enum {NONE = 0, black = 1, white = 2};
ATTACK: Offense: Defend: Defense
enum {ATTACK = 0, defend = 1};
Man_first: Black First: Computer_first: Baixian
enum {man_first = 0, Computer_first = 1};
Both_pease: And: Black_win: Black wins White_win: Baek Seung
enum {both_pease=0, Black_win = 1, White_win = 2};
L_to_r: Left to right t_to_b: top to bottom: Lb_to_rt: Lower left to upper right, LT_TO_RB top left to bottom right
enum {l_to_r=0, T_to_b = 1, Lb_to_rt = 2, LT_TO_RB = 3};
Cchess fivechess;
int m_nlastblackpos_x;
int m_nlastblackpos_y;
int m_ncurrentwhitepos_x;
int m_ncurrentwhitepos_y;
In the CMainFrame class PreCreateWindow (createstruct& CS) Adds the following code to set the fixed window size:
BOOL CMainFrame::P Recreatewindow (createstruct& CS)
{
if (! CFrameWnd::P Recreatewindow (CS))
return FALSE;
Cs.style = ws_overlapped | Ws_sysmenu | ws_minimizebox;//| Ws_thickframe;
Cs.style &= ~ws_border;
Cs.dwexstyle &= ~ws_ex_clientedge;
int Iwinborderx = GetSystemMetrics (Sm_cxborder);
int iwinbordery = GetSystemMetrics (Sm_cyborder);
int icaptiony = GetSystemMetrics (sm_cycaption);
int imenuy = GetSystemMetrics (Sm_cymenu);
int istausy = GetSystemMetrics (Sm_cymenu);
CS.CX = 510 + Iwinborderx;
cs.cy = 530 + iwinbordery + icaptiony + istausy + imenuy;
return TRUE;
}