moves.h

来自「EVC4.0开发的国际象棋的元代码」· C头文件 代码 · 共 59 行

H
59
字号
/****************************************************
Author: S. Senthil kumar
Class Name: Moves
Purpose:    To Generate Moves and store in a linked list

******************************************************/

class Moves
{
	
public:
	OneMove *head;						//Head of the linked list
	OneMove *current;					//Current node in the linked list
	OneMove *acurrent;OneMove *ncurrent;//Current nodes in attack list, quiscent list
	OneMove *attackhead;				//Head of attack list
	OneMove *normalhead;				//Head of quiscent list
	int tempboard[8][8];				//Temporary board
	int size;							//Total Size of the linked list (ie) Total moves generated
	
	
	/*To add a move to the linked list
	Arguments:
		p: piece Id
		sourcex,sourcey: Starting square
		dx,dy:		   : Destination square
		noa			   : Boolean variable to indicate whether attacking or quiscent move
	*/
	void add(int p,int sourcex,int sourcey,int dx,int dy,int noa);
	
	
	/*Constructor*/
	Moves();


	
	/*Combines attack list and quiscent list with attack list at the head*/
	void combine();
	
	
	/*Destroys the linked list of moves*/ 
	void destroy();
	
	
	/*Main move generating routines
	  Arguments:
		board[8][8] : Current board
		int color	: To Generate for white or black
	*/
	void GeneratePawnMoves(int board[8][8],int color);
	void GenerateKnightMoves(int board[8][8],int color);
	void GenerateBishopMoves(int board[8][8],int color);
	void GenerateRookMoves(int board[8][8],int color);
	void GenerateQueenMoves(int board[8][8],int color);
	void GenerateKingMoves(int board[8][8],int color);

	
	/*Driver Routine*/
	int GenerateAllMoves(int board[8][8],int color,int depth,int check_for_mate);
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?