Chess in C++

Pages: 12
I Have written this chess program in c++
but i cant write checkmate properly
can someone help
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream>
using namespace std;

void disp_board();
void player_turn();
void rook(char, int ,int, int, int);
void knight(char, int ,int, int, int);
void bishop(char, int ,int, int, int);
void queen(char, int ,int, int, int);
void king(char, int ,int, int, int);
void pawnw(char, int ,int, int, int);
void pawnb(char, int ,int, int, int);
bool check(char);
bool checkmate();
bool stalemate();

int i=1;
char z=(char)176;
char x;
int row;
int row1;
int column;
int column1;
char turn;
char board[10][10] = {{'/','/','/','/','/','/','/','/','/','/'},       // Main Board    
                      {'/','r','n','b','q','k','b','n','r','/'},                 
			    	  {'/','p','p','p','p','p','p','p','p','/'},
			  		  {'/',' ',' ',' ',' ',' ',' ',' ',' ','/'},
			  		  {'/',' ',' ',' ',' ',' ',' ',' ',' ','/'},
			  		  {'/',' ',' ',' ',' ',' ',' ',' ',' ','/'},
			 		  {'/',' ',' ',' ',' ',' ',' ',' ',' ','/'},
			  		  {'/','P','P','P','P','P','P','P','P','/'},
			  		  {'/','R','N','B','Q','K','B','N','R','/'},
					  {'/','/','/','/','/','/','/','/','/','/'}};		  		

char extra[2][2] = {{' ',' '},                                         // Used For Checking Castling
					{' ',' '}};

char pawn[2][8] = {{' ',' ',' ',' ',' ',' ',' ',' '},                  // Used For Checking En Passant
				   {' ',' ',' ',' ',' ',' ',' ',' '}};
int main()                                      // Main Program
{
	turn='X';
	while(i>0)                                  // Executes Game
	{
		cout<<"Chess"<<endl;
		disp_board();                           // Displays Board
		player_turn();                          // Executes Player Turn
		system("cls");                          // Clears Screen After 1 Turn
	}
	system("pause");
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
void disp_board()                               //Displays Board
{
	cout<<"\t    a     b     c     d     e     f     g     h   "<<endl;
	cout<<"\t        _____       _____       _____       _____ "<<endl;
	cout<<"\t |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<endl;
	cout<<"\t8|"<<z<<z<<board[1][1]<<z<<z<<"|  "<<board[1][2]<<"  |"<<z<<z<<board[1][3]<<z<<z<<"|  "<<board[1][4]<<"  |"<<z<<z<<board[1][5]<<z<<z<<"|  "<<board[1][6]<<"  |"<<z<<z<<board[1][7]<<z<<z<<"|  "<<board[1][8]<<"  |8"<<endl;
	cout<<"\t |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<endl;
	cout<<"\t |     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|"<<endl;
	cout<<"\t7|  "<<board[2][1]<<"  |"<<z<<z<<board[2][2]<<z<<z<<"|  "<<board[2][3]<<"  |"<<z<<z<<board[2][4]<<z<<z<<"|  "<<board[2][5]<<"  |"<<z<<z<<board[2][6]<<z<<z<<"|  "<<board[2][7]<<"  |"<<z<<z<<board[2][8]<<z<<z<<"|7"<<endl;
	cout<<"\t |     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|"<<endl;
	cout<<"\t |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<endl;
	cout<<"\t6|"<<z<<z<<board[3][1]<<z<<z<<"|  "<<board[3][2]<<"  |"<<z<<z<<board[3][3]<<z<<z<<"|  "<<board[3][4]<<"  |"<<z<<z<<board[3][5]<<z<<z<<"|  "<<board[3][6]<<"  |"<<z<<z<<board[3][7]<<z<<z<<"|  "<<board[3][8]<<"  |6"<<endl;
	cout<<"\t |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<endl;
	cout<<"\t |     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|"<<endl;
	cout<<"\t5|  "<<board[4][1]<<"  |"<<z<<z<<board[4][2]<<z<<z<<"|  "<<board[4][3]<<"  |"<<z<<z<<board[4][4]<<z<<z<<"|  "<<board[4][5]<<"  |"<<z<<z<<board[4][6]<<z<<z<<"|  "<<board[4][7]<<"  |"<<z<<z<<board[4][8]<<z<<z<<"|5"<<endl;
	cout<<"\t |     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|"<<endl;
	cout<<"\t |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<endl;
	cout<<"\t4|"<<z<<z<<board[5][1]<<z<<z<<"|  "<<board[5][2]<<"  |"<<z<<z<<board[5][3]<<z<<z<<"|  "<<board[5][4]<<"  |"<<z<<z<<board[5][5]<<z<<z<<"|  "<<board[5][6]<<"  |"<<z<<z<<board[5][7]<<z<<z<<"|  "<<board[5][8]<<"  |4"<<endl;
	cout<<"\t |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<endl;
	cout<<"\t |     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|"<<endl;
	cout<<"\t3|  "<<board[6][1]<<"  |"<<z<<z<<board[6][2]<<z<<z<<"|  "<<board[6][3]<<"  |"<<z<<z<<board[6][4]<<z<<z<<"|  "<<board[6][5]<<"  |"<<z<<z<<board[6][6]<<z<<z<<"|  "<<board[6][7]<<"  |"<<z<<z<<board[6][8]<<z<<z<<"|3"<<endl;
	cout<<"\t |     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|"<<endl;
	cout<<"\t |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<endl;
	cout<<"\t2|"<<z<<z<<board[7][1]<<z<<z<<"|  "<<board[7][2]<<"  |"<<z<<z<<board[7][3]<<z<<z<<"|  "<<board[7][4]<<"  |"<<z<<z<<board[7][5]<<z<<z<<"|  "<<board[7][6]<<"  |"<<z<<z<<board[7][7]<<z<<z<<"|  "<<board[7][8]<<"  |2"<<endl;
	cout<<"\t |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<endl;
	cout<<"\t |     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|     |"<<z<<z<<z<<z<<z<<"|"<<endl;
	cout<<"\t1|  "<<board[8][1]<<"  |"<<z<<z<<board[8][2]<<z<<z<<"|  "<<board[8][3]<<"  |"<<z<<z<<board[8][4]<<z<<z<<"|  "<<board[8][5]<<"  |"<<z<<z<<board[8][6]<<z<<z<<"|  "<<board[8][7]<<"  |"<<z<<z<<board[8][8]<<z<<z<<"|1"<<endl;
	cout<<"\t |_____|"<<z<<z<<z<<z<<z<<"|_____|"<<z<<z<<z<<z<<z<<"|_____|"<<z<<z<<z<<z<<z<<"|_____|"<<z<<z<<z<<z<<z<<"|"<<endl<<endl;
	cout<<"\t    a     b     c     d     e     f     g     h"<<endl;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
void player_turn()                              // Rules Of Player Turn
{
	if (board[8][5]!='K') {extra[1][0]='!'; extra[1][1]='!'; }                                     // Checks Castling
	if (board[8][1]!='R')  extra[1][0]='!';                                                        // Checks Castling
	if (board[8][8]!='R')  extra[1][1]='!';                                                        // Checks Castling
	if (board[1][5]!='k') {extra[0][0]='!'; extra[0][1]='!'; }                                     // Checks Castling
	if (board[1][1]!='r')  extra[0][0]='!';                                                        // Checks Castling
	if (board[1][8]!='r')  extra[0][1]='!';                                                        // Checks Castling
	if(check(turn))
	cout<<"Check"<<endl;
	char choice;
	char choice1;
	if(turn == 'X')
	cout<<"Player 1 [White]---"<<endl;
	else if (turn == 'Y')
	cout<<"Player 2 [Black]---"<<endl;
	cout<<"Enter Co-ordinate Of Cell: ";
	cin>>choice>>choice1;
	switch (choice)                                                                                // Selects Column
	{
		case 'a': column=1; break;
		case 'b': column=2; break;
		case 'c': column=3; break;
		case 'd': column=4; break;
		case 'e': column=5; break;
		case 'f': column=6; break;
		case 'g': column=7; break;
		case 'h': column=8; break;
		default: ;
	}
	switch (choice1)                                                                               // Selects Row
	{
		case '1': row=8; break;
		case '2': row=7; break;
		case '3': row=6; break;
		case '4': row=5; break;
		case '5': row=4; break;
		case '6': row=3; break;
		case '7': row=2; break;
		case '8': row=1; break;
		default: ;
	}
	cout<<"Enter Co-ordinate Of Cell You Want To Move To: ";
	cin>>choice>>choice1;
	switch (choice)                                                                                // Selcts Column To Move To
	{
		case 'a': column1=1; break;
		case 'b': column1=2; break;
		case 'c': column1=3; break;
		case 'd': column1=4; break;
		case 'e': column1=5; break;
		case 'f': column1=6; break;
		case 'g': column1=7; break;
		case 'h': column1=8; break;
		default: ;
	}
	switch (choice1)                                                                               // Selcts Row To Move To
	{
		case '1': row1=8; break;
		case '2': row1=7; break;
		case '3': row1=6; break;
		case '4': row1=5; break;
		case '5': row1=4; break;
		case '6': row1=3; break;
		case '7': row1=2; break;
		case '8': row1=1; break;
		default: ;
	}
	if (turn == 'X')                                                                               // Moves To Function According To Piece
	{
		if (board[row][column]=='R')      {	rook(turn, row, column, row1, column1); turn ='Y'; }
		else if (board[row][column]=='N') {	knight(turn, row, column, row1, column1); turn ='Y'; }
		else if (board[row][column]=='B') {	bishop(turn, row, column, row1, column1); turn ='Y'; }
		else if (board[row][column]=='Q') {	queen(turn, row, column, row1, column1); turn ='Y'; }
		else if (board[row][column]=='K') { king(turn, row, column, row1, column1); turn ='Y'; }
		else if (board[row][column]=='P') { pawnw(turn, row, column, row1, column1); turn ='Y'; }
		else { cout<<"You Have Entered a Wrong Co-ordinate, Please Try Again"<<endl<<endl; player_turn(); }
	}
	else if (turn == 'Y')                                                                          // Moves To Function According To Piece
	{
		if (board[row][column]=='r')      {	rook(turn, row, column, row1, column1); turn ='X'; }
		else if (board[row][column]=='n') {	knight(turn, row, column, row1, column1); turn ='X'; }
		else if (board[row][column]=='b') {	bishop(turn, row, column, row1, column1); turn ='X'; }
		else if (board[row][column]=='q') {	queen(turn, row, column, row1, column1); turn ='X'; }
		else if (board[row][column]=='k') {	king(turn, row, column, row1, column1); turn ='X'; }
		else if (board[row][column]=='p') {	pawnb(turn, row, column, row1, column1); turn ='X'; }
		else {	cout<<"You Have Entered a Wrong Co-ordinate, Please Try Again"<<endl<<endl; player_turn(); }
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
void rook(char turn, int row, int column, int row1, int column1)       // Rules Of Rook
{
	int sum1=0;
	int sum2=0;
	int sum3=0;
	int sum4=0;
				for (int j=1; row+j<row1; j++)                                         // Checks Moving Down
				{
					if (board[row+j][column]==' ')
					sum1++;
				}
				for (int j=1; row-j>row1; j++)                                         // Checks Moving Up
				{
					if (board[row-j][column]==' ')
					sum2++;
				}
				for (int j=1; column+j<column1; j++)                                   // Checks Moving Right
				{
					if (board[row][column+j]==' ')
					sum3++;
				}
				for (int j=1; column-j>column1; j++)                                   // Checks Moving Left
				{
					if (board[row][column-j]==' ')
					sum4++;
				}
	if ((row1!=row && column1!=column) || (row1==row && column1==column) )                                                                                      // Allows Movement
	{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }	
	else if (turn=='X')
	{
		if ((row1==row+1 && column1==column) || (row1==row+2 && column1==column) || (row1==row+3 && column1==column) || (row1==row+4 && column1==column) ||            // Moves Down
			(row1==row+5 && column1==column) || (row1==row+6 && column1==column) || (row1==row+7 && column1==column) || (row1==row+8 && column1==column))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
			    board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum1!=row1-row-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='R'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='R'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row-1 && column1==column) || (row1==row-2 && column1==column) || (row1==row-3 && column1==column) || (row1==row-4 && column1==column) ||       // Moves Up
			     (row1==row-5 && column1==column) || (row1==row-6 && column1==column) || (row1==row-7 && column1==column) || (row1==row-8 && column1==column))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
			    board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum2!=row-row1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='R'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='R'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row && column1==column+1) || (row1==row && column1==column+2) || (row1==row && column1==column+3) || (row1==row && column1==column+4) ||       // Moves Left
			     (row1==row && column1==column+5) || (row1==row && column1==column+6) || (row1==row && column1==column+7) || (row1==row && column1==column+8))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
			    board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum3!=column1-column-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='R'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='R'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row && column1==column-1) || (row1==row && column1==column-2) || (row1==row && column1==column-3) || (row1==row && column1==column-4) ||       // Moves Right
			     (row1==row && column1==column-5) || (row1==row && column1==column-6) || (row1==row && column1==column-7) || (row1==row && column1==column-8))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
			    board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum4!=column-column1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='R'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='R'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
	}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
else if (turn=='Y')
	{
		if ((row1==row+1 && column1==column) || (row1==row+2 && column1==column) || (row1==row+3 && column1==column) || (row1==row+4 && column1==column) ||            // Moves Down
			(row1==row+5 && column1==column) || (row1==row+6 && column1==column) || (row1==row+7 && column1==column) || (row1==row+8 && column1==column))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
			    board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum1!=row1-row-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='r'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='r'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row-1 && column1==column) || (row1==row-2 && column1==column) || (row1==row-3 && column1==column) || (row1==row-4 && column1==column) ||       // Moves Up
			     (row1==row-5 && column1==column) || (row1==row-6 && column1==column) || (row1==row-7 && column1==column) || (row1==row-8 && column1==column))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
			    board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum2!=row-row1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='r'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='r'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row && column1==column+1) || (row1==row && column1==column+2) || (row1==row && column1==column+3) || (row1==row && column1==column+4) ||       // Moves Left
			     (row1==row && column1==column+5) || (row1==row && column1==column+6) || (row1==row && column1==column+7) || (row1==row && column1==column+8))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
			    board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum3!=column1-column-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='r'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='r'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row && column1==column-1) || (row1==row && column1==column-2) || (row1==row && column1==column-3) || (row1==row && column1==column-4) ||       // Moves Right
			     (row1==row && column1==column-5) || (row1==row && column1==column-6) || (row1==row && column1==column-7) || (row1==row && column1==column-8))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
			    board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum4!=column-column1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='r'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='r'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
void knight(char turn, int row, int column, int row1, int column1)     // Rules Of Knight
{
	if (!((row1==row+1 && column1==column+2) || (row1==row+2 && column1==column+1) || (row1==row-1 && column1==column+2) || (row1==row-2 && column1==column+1) ||    // Allows Movement    
	      (row1==row+1 && column1==column-2) || (row1==row+2 && column1==column-1) || (row1==row-1 && column1==column-2) || (row1==row-2 && column1==column-1)))
	{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
	else if (turn=='X')
	{
		if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' ||        // Moves 8 Differnt L Shapes  
		    board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
		{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
		else
			{	x=board[row1][column1]; board[row1][column1]='N'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='N'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
	}
	else if (turn=='Y')
	{
		if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' ||        // Moves 8 Differnt L Shapes  
		    board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
		{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
		else
			{	x=board[row1][column1]; board[row1][column1]='n'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='n'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
void bishop(char turn, int row, int column, int row1, int column1)     // Rules Of Bishop
{
	int sum1=0;
	int sum2=0;
	int sum3=0;
	int sum4=0;
				for (int j=1; row+j<row1, column+j<column1; j++)                                         // Checks Moving Right-Down
				{
					if (board[row+j][column+j]==' ')
					sum1++;
				}
				for (int j=1; row-j>row1, column+j<column1; j++)                                         // Checks Moving Right-Up
				{
					if (board[row-j][column+j]==' ')
					sum2++;
				}
				for (int j=1; row+j<row1, column-j>column1; j++)                                         // Checks Moving Left-Down
				{
					if (board[row+j][column-j]==' ')
					sum3++;
				}
				for (int j=1; row-j>row1, column-j>column1; j++)                                         // Checks Moving left-Up
				{
					if (board[row-j][column-j]==' ')
					sum4++;
				}
	if (!((row1==row+1 && column1==column+1) || (row1==row+2 && column1==column+2) || (row1==row+3 && column1==column+3) || (row1==row+4 && column1==column+4) || // Allows Movement
	      (row1==row+5 && column1==column+5) || (row1==row+6 && column1==column+6) || (row1==row+7 && column1==column+7) || (row1==row+8 && column1==column+8) ||
	      (row1==row+1 && column1==column-1) || (row1==row+2 && column1==column-2) || (row1==row+3 && column1==column-3) || (row1==row+4 && column1==column-4) ||
	      (row1==row+5 && column1==column-5) || (row1==row+6 && column1==column-6) || (row1==row+7 && column1==column-7) || (row1==row+8 && column1==column-8) ||
	      (row1==row-1 && column1==column+1) || (row1==row-2 && column1==column+2) || (row1==row-3 && column1==column+3) || (row1==row-4 && column1==column+4) ||
	      (row1==row-5 && column1==column+5) || (row1==row-6 && column1==column+6) || (row1==row-7 && column1==column+7) || (row1==row-8 && column1==column+8) ||
	      (row1==row-1 && column1==column-1) || (row1==row-2 && column1==column-2) || (row1==row-3 && column1==column-3) || (row1==row-4 && column1==column-4) ||
		  (row1==row-5 && column1==column-5) || (row1==row-6 && column1==column-6) || (row1==row-7 && column1==column-7) || (row1==row-8 && column1==column-8))) 
	{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
	else if (turn=='X')
	{
		if ((row1==row+1 && column1==column+1) || (row1==row+2 && column1==column+2) || 
		    (row1==row+3 && column1==column+3) || (row1==row+4 && column1==column+4) ||                                                                           // Moves Right-Down
	        (row1==row+5 && column1==column+5) || (row1==row+6 && column1==column+6) || 
			(row1==row+7 && column1==column+7) || (row1==row+8 && column1==column+8))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
		        board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum1!= row1-row-1 && sum1!= column1-column-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='B'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='B'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row-1 && column1==column+1) || (row1==row-2 && column1==column+2) || 
		         (row1==row-3 && column1==column+3) || (row1==row-4 && column1==column+4) ||                                                                      // Moves Right-Up
	             (row1==row-5 && column1==column+5) || (row1==row-6 && column1==column+6) || 
				 (row1==row-7 && column1==column+7) || (row1==row-8 && column1==column+8))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
		        board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum2!= row-row1-1 && sum2!= column1-column-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='B'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='B'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row+1 && column1==column-1) || (row1==row+2 && column1==column-2) || 
		         (row1==row+3 && column1==column-3) || (row1==row+4 && column1==column-4) ||                                                                      // Moves Left-Down
	             (row1==row+5 && column1==column-5) || (row1==row+6 && column1==column-6) || 
				 (row1==row+7 && column1==column-7) || (row1==row+8 && column1==column-8))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
		        board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum3!= row1-row-1 && sum3!=column-column1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='B'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='B'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row-1 && column1==column-1) || (row1==row-2 && column1==column-2) || 
		         (row1==row-3 && column1==column-3) || (row1==row-4 && column1==column-4) ||                                                                      // Moves Left-Up
	             (row1==row-5 && column1==column-5) || (row1==row-6 && column1==column-6) || 
				 (row1==row-7 && column1==column-7) || (row1==row-8 && column1==column-8))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
		        board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum4!= row-row1-1 && sum4!= column-column1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='B'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='B'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
	}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
else if (turn=='Y')
	{
		if ((row1==row+1 && column1==column+1) || (row1==row+2 && column1==column+2) || 
		    (row1==row+3 && column1==column+3) || (row1==row+4 && column1==column+4) ||                                                                           // Moves Right-Down
	        (row1==row+5 && column1==column+5) || (row1==row+6 && column1==column+6) || 
			(row1==row+7 && column1==column+7) || (row1==row+8 && column1==column+8))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
		        board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum1!= row1-row-1 && sum1!= column1-column-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='b'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='b'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row-1 && column1==column+1) || (row1==row-2 && column1==column+2) || 
		         (row1==row-3 && column1==column+3) || (row1==row-4 && column1==column+4) ||                                                                      // Moves Right-Up
	             (row1==row-5 && column1==column+5) || (row1==row-6 && column1==column+6) || 
				 (row1==row-7 && column1==column+7) || (row1==row-8 && column1==column+8))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
		        board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum2!= row-row1-1 && sum2!= column1-column-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='b'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='b'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row+1 && column1==column-1) || (row1==row+2 && column1==column-2) || 
		         (row1==row+3 && column1==column-3) || (row1==row+4 && column1==column-4) ||                                                                      // Moves Left-Down
	             (row1==row+5 && column1==column-5) || (row1==row+6 && column1==column-6) || 
				 (row1==row+7 && column1==column-7) || (row1==row+8 && column1==column-8))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
		        board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum3!= row1-row-1 && sum3!=column-column1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='b'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='b'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row-1 && column1==column-1) || (row1==row-2 && column1==column-2) || 
		         (row1==row-3 && column1==column-3) || (row1==row-4 && column1==column-4) ||                                                                      // Moves Left-Up
	             (row1==row-5 && column1==column-5) || (row1==row-6 && column1==column-6) || 
				 (row1==row-7 && column1==column-7) || (row1==row-8 && column1==column-8))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
		        board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum4!= row-row1-1 && sum4!= column-column1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='b'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='b'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
void queen(char turn, int row, int column, int row1, int column1)      // Rules Of Queen
{
	int sum1=0;
	int sum2=0;
	int sum3=0;
	int sum4=0;
	int sum5=0;
	int sum6=0;
	int sum7=0;
	int sum8=0;
				for (int j=1; row+j<row1; j++)                                         // Checks Moving Down
				{
					if (board[row+j][column]==' ')
					sum1++;
				}
				for (int j=1; row-j>row1; j++)                                         // Checks Moving Up
				{
					if (board[row-j][column]==' ')
					sum2++;
				}
				for (int j=1; column+j<column1; j++)                                   // Checks Moving Right
				{
					if (board[row][column+j]==' ')
					sum3++;
				}
				for (int j=1; column-j>column1; j++)                                   // Checks Moving Left
				{
					if (board[row][column-j]==' ')
					sum4++;
				}
				for (int j=1; row+j<row1, column+j<column1; j++)                       // Checks Moving Right-Down
				{
					if (board[row+j][column+j]==' ')
					sum5++;
				}
				for (int j=1; row-j>row1, column+j<column1; j++)                       // Checks Moving Right-Up
				{
					if (board[row-j][column+j]==' ')
					sum6++;
				}
				for (int j=1; row+j<row1, column-j>column1; j++)                       // Checks Moving Left-Down
				{
					if (board[row+j][column-j]==' ')
					sum7++;
				}
				for (int j=1; row-j>row1, column-j>column1; j++)                       // Checks Moving left-Up
				{
					if (board[row-j][column-j]==' ')
					sum8++;
				}
	if (!((row1==row+1 && column1==column+1) || (row1==row+2 && column1==column+2) || (row1==row+3 && column1==column+3) || (row1==row+4 && column1==column+4) || // Allows Movement
	      (row1==row+5 && column1==column+5) || (row1==row+6 && column1==column+6) || (row1==row+7 && column1==column+7) || (row1==row+8 && column1==column+8) ||
	      (row1==row+1 && column1==column-1) || (row1==row+2 && column1==column-2) || (row1==row+3 && column1==column-3) || (row1==row+4 && column1==column-4) ||
	      (row1==row+5 && column1==column-5) || (row1==row+6 && column1==column-6) || (row1==row+7 && column1==column-7) || (row1==row+8 && column1==column-8) ||
	      (row1==row-1 && column1==column+1) || (row1==row-2 && column1==column+2) || (row1==row-3 && column1==column+3) || (row1==row-4 && column1==column+4) ||
	      (row1==row-5 && column1==column+5) || (row1==row-6 && column1==column+6) || (row1==row-7 && column1==column+7) || (row1==row-8 && column1==column+8) ||
	      (row1==row-1 && column1==column-1) || (row1==row-2 && column1==column-2) || (row1==row-3 && column1==column-3) || (row1==row-4 && column1==column-4) ||
		  (row1==row-5 && column1==column-5) || (row1==row-6 && column1==column-6) || (row1==row-7 && column1==column-7) || (row1==row-8 && column1==column-8) ||
		  (row1==row && column1!=column) || (row1!=row && column1==column)))
		{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
	else if (turn=='X')
	{
		if ((row1==row+1 && column1==column) || (row1==row+2 && column1==column) || (row1==row+3 && column1==column) || (row1==row+4 && column1==column) ||       // Moves Down
			(row1==row+5 && column1==column) || (row1==row+6 && column1==column) || (row1==row+7 && column1==column) || (row1==row+8 && column1==column))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
			    board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum1!=row1-row-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='Q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='Q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row-1 && column1==column) || (row1==row-2 && column1==column) || (row1==row-3 && column1==column) || (row1==row-4 && column1==column) ||  // Moves Up
			     (row1==row-5 && column1==column) || (row1==row-6 && column1==column) || (row1==row-7 && column1==column) || (row1==row-8 && column1==column))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
			    board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum2!=row-row1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='Q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='Q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row && column1==column+1) || (row1==row && column1==column+2) || (row1==row && column1==column+3) || (row1==row && column1==column+4) ||  // Moves Left
			     (row1==row && column1==column+5) || (row1==row && column1==column+6) || (row1==row && column1==column+7) || (row1==row && column1==column+8))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
			    board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum3!=column1-column-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='Q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='Q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row && column1==column-1) || (row1==row && column1==column-2) || (row1==row && column1==column-3) || (row1==row && column1==column-4) ||  // Moves Right
			     (row1==row && column1==column-5) || (row1==row && column1==column-6) || (row1==row && column1==column-7) || (row1==row && column1==column-8))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
			    board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum4!=column-column1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='Q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='Q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
else if ((row1==row+1 && column1==column+1) || (row1==row+2 && column1==column+2) || 
		         (row1==row+3 && column1==column+3) || (row1==row+4 && column1==column+4) ||                                                                      // Moves Right-Down
	             (row1==row+5 && column1==column+5) || (row1==row+6 && column1==column+6) || 
				 (row1==row+7 && column1==column+7) || (row1==row+8 && column1==column+8))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
		        board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum5!= row1-row-1 && sum5!= column1-column-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='Q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='Q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row-1 && column1==column+1) || (row1==row-2 && column1==column+2) || 
		         (row1==row-3 && column1==column+3) || (row1==row-4 && column1==column+4) ||                                                                      // Moves Right-Up
	             (row1==row-5 && column1==column+5) || (row1==row-6 && column1==column+6) || 
				 (row1==row-7 && column1==column+7) || (row1==row-8 && column1==column+8))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
		        board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum6!= row-row1-1 && sum6!= column1-column-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='Q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='Q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row+1 && column1==column-1) || (row1==row+2 && column1==column-2) || 
		         (row1==row+3 && column1==column-3) || (row1==row+4 && column1==column-4) ||                                                                      // Moves Left-Down
	             (row1==row+5 && column1==column-5) || (row1==row+6 && column1==column-6) || 
				 (row1==row+7 && column1==column-7) || (row1==row+8 && column1==column-8))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
		        board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum7!= row1-row-1 && sum7!=column-column1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='Q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='Q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row-1 && column1==column-1) || (row1==row-2 && column1==column-2) || 
		         (row1==row-3 && column1==column-3) || (row1==row-4 && column1==column-4) ||                                                                      // Moves Left-Up
	             (row1==row-5 && column1==column-5) || (row1==row-6 && column1==column-6) || 
				 (row1==row-7 && column1==column-7) || (row1==row-8 && column1==column-8))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
		        board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum8!= row-row1-1 && sum8!= column-column1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='Q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='Q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
	}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
else if (turn=='Y')
	{
		if ((row1==row+1 && column1==column) || (row1==row+2 && column1==column) || (row1==row+3 && column1==column) || (row1==row+4 && column1==column) ||       // Moves Down
			(row1==row+5 && column1==column) || (row1==row+6 && column1==column) || (row1==row+7 && column1==column) || (row1==row+8 && column1==column))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
			    board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum1!=row1-row-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row-1 && column1==column) || (row1==row-2 && column1==column) || (row1==row-3 && column1==column) || (row1==row-4 && column1==column) ||  // Moves Up
			     (row1==row-5 && column1==column) || (row1==row-6 && column1==column) || (row1==row-7 && column1==column) || (row1==row-8 && column1==column))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
			    board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum2!=row-row1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row && column1==column+1) || (row1==row && column1==column+2) || (row1==row && column1==column+3) || (row1==row && column1==column+4) ||  // Moves Left
			     (row1==row && column1==column+5) || (row1==row && column1==column+6) || (row1==row && column1==column+7) || (row1==row && column1==column+8))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
			    board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum3!=column1-column-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row && column1==column-1) || (row1==row && column1==column-2) || (row1==row && column1==column-3) || (row1==row && column1==column-4) ||  // Moves Right
			     (row1==row && column1==column-5) || (row1==row && column1==column-6) || (row1==row && column1==column-7) || (row1==row && column1==column-8))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
			    board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (sum4!=column-column1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
else if ((row1==row+1 && column1==column+1) || (row1==row+2 && column1==column+2) || 
		         (row1==row+3 && column1==column+3) || (row1==row+4 && column1==column+4) ||                                                                      // Moves Right-Down
	             (row1==row+5 && column1==column+5) || (row1==row+6 && column1==column+6) || 
				 (row1==row+7 && column1==column+7) || (row1==row+8 && column1==column+8))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
		        board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum5!= row1-row-1 && sum5!= column1-column-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row-1 && column1==column+1) || (row1==row-2 && column1==column+2) || 
		         (row1==row-3 && column1==column+3) || (row1==row-4 && column1==column+4) ||                                                                      // Moves Right-Up
	             (row1==row-5 && column1==column+5) || (row1==row-6 && column1==column+6) || 
				 (row1==row-7 && column1==column+7) || (row1==row-8 && column1==column+8))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
		        board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum6!= row-row1-1 && sum6!= column1-column-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row+1 && column1==column-1) || (row1==row+2 && column1==column-2) || 
		         (row1==row+3 && column1==column-3) || (row1==row+4 && column1==column-4) ||                                                                      // Moves Left-Down
	             (row1==row+5 && column1==column-5) || (row1==row+6 && column1==column-6) || 
				 (row1==row+7 && column1==column-7) || (row1==row+8 && column1==column-8))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
		        board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum7!= row1-row-1 && sum7!=column-column1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if ((row1==row-1 && column1==column-1) || (row1==row-2 && column1==column-2) || 
		         (row1==row-3 && column1==column-3) || (row1==row-4 && column1==column-4) ||                                                                      // Moves Left-Up
	             (row1==row-5 && column1==column-5) || (row1==row-6 && column1==column-6) || 
				 (row1==row-7 && column1==column-7) || (row1==row-8 && column1==column-8))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
		        board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if(sum8!= row-row1-1 && sum8!= column-column1-1)
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='q'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='q'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
void king(char turn, int row, int column, int row1, int column1)       // Rules Of King
{
	if (!((row1==row+1 && column1==column+1) || (row1==row+1 && column1==column) ||                                  // Allows Movement
	      (row1==row+1 && column1==column-1) || (row1==row && column1==column+1) || 
		  (row1==row && column1==column-1) || (row1==row-1 && column1==column+1) || 
		  (row1==row-1 && column1==column) || (row1==row-1 && column1==column-1) || 
		  (row1==row && column1==column-2) || (row1==row && column1==column+2)))
	{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
	else if (turn=='X')
	{
		if ((row1==row+1 && column1==column+1) || (row1==row+1 && column1==column) ||                                // Moves Along 8 Adjacent Boxes 
		    (row1==row+1 && column1==column-1) || (row1==row && column1==column+1) ||
		    (row1==row && column1==column-1) || (row1==row-1 && column1==column+1) || 
			(row1==row-1 && column1==column) || (row1==row-1 && column1==column-1))
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
			    board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='K'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='K'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if (row1==row && column1==column-2)                                                                     // Moves Queen Side Castling
		{
			if (board[row1][column1]!=' ' || board[row1][column1+1]!=' ' ||
				board[row1][column1-1]!=' ' || check(turn))
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if (extra[1][0]=='!')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1+1]; board[row1][column1+1]='K'; board[row][column]=' ';
				if(check(turn))
				{	board[row1][column1+1]=x; board[row][column]='K'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
				x=board[row1][column1]; board[row1][column1]='K'; board[row][column]=' '; board[row1][column1+1]='R'; board[8][1]=' '; 
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='K'; board[8][1]='R'; board[row1][column1+1]=' '; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if (row1==row && column1==column+2)                                                                     // Moves King Side Castling
		{
			if (board[row1][column1]!=' ' || board[row1][column1-1]!=' ' || check(turn))
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if (extra[1][1]=='!')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1-1]; board[row1][column1-1]='K'; board[row][column]=' ';
				if(check(turn))
				{	board[row1][column1-1]=x; board[row][column]='K'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
				x=board[row1][column1]; board[row1][column1]='K'; board[row][column]=' '; board[row1][column1-1]='R'; board[8][8]=' '; 
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='K'; board[8][8]='R'; board[row1][column1-1]=' '; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
	}
	else if (turn=='Y')
	{
		if ((row1==row+1 && column1==column+1) || (row1==row+1 && column1==column) ||                                // Moves Along 8 Adjacent Boxes  
		    (row1==row+1 && column1==column-1) || (row1==row && column1==column+1) ||
		    (row1==row && column1==column-1) || (row1==row-1 && column1==column+1) || 
			(row1==row-1 && column1==column) || (row1==row-1 && column1==column-1))
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
			    board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1]; board[row1][column1]='k'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='k'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if (row1==row && column1==column-2)                                                                     // Moves Queen Side Castling
		{
			if (board[row1][column1]!=' ' || board[row1][column1+1]!=' ' ||
				board[row1][column1-1]!=' ' || check(turn))
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if (extra[0][0]=='!')
			{	cout<<"Wrong Cell, Please Try Agai"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1+1]; board[row1][column1+1]='k'; board[row][column]=' ';
				if(check(turn))
				{	board[row1][column1+1]=x; board[row][column]='k'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
				x=board[row1][column1]; board[row1][column1]='k'; board[row][column]=' '; board[row1][column1+1]='r'; board[1][1]=' '; 
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='k'; board[8][1]='r'; board[row1][column1+1]=' '; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if (row1==row && column1==column+2)                                                                     // Moves King Side Castling
		{
			if (board[row1][column1]!=' ' || board[row1][column1-1]!=' ' || check(turn))
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else if (extra[0][1]=='!')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
			else
			{	x=board[row1][column1-1]; board[row1][column1-1]='k'; board[row][column]=' ';
				if(check(turn))
				{	board[row1][column1-1]=x; board[row][column]='k'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
				x=board[row1][column1]; board[row1][column1]='k'; board[row][column]=' '; board[row1][column1-1]='r'; board[1][8]=' '; 
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='k'; board[1][8]='r'; board[row1][column1-1]=' '; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
void pawnw(char turn, int row, int column, int row1, int column1)      // Rules Of White Pawns
{
	if (!((row1==row-1 && column1==column) || (row==7 && row1==row-2 && column1==column) ||                                                          // Allows Movement
	      (row1==row-1 && column1==column-1 && board[row1][column1]!=' ') || (row1==row-1 && column1==column+1 && board[row1][column1]!=' ') ||
		  (row==4 && row1==row-1 && column1==column-1 && board[row1][column1]==' ') || (row==4 && row1==row-1 && column1==column+1 && board[row1][column1]==' ')))
	{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
	else if (turn=='X')
	{
		if (row1==row-1 && column1==column)                                                                                                          // Moves 1 Box Up
		{
			if (board[row1][column1]!=' ')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='P'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='P'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
				if (row1==1)                                                                                                                        // Promotion
				{
					cell:
					cout<<"Congratulations, Your Pawn Has Been Promoted\n Chose Your Promotion(Q or B or N or R): ";
					char prom;
					cin>>prom;
					switch (prom)
					{
						case 'Q': board[row1][column1]='Q'; board[row][column]=' '; break;
						case 'B': board[row1][column1]='B'; board[row][column]=' '; break;
						case 'N': board[row1][column1]='N'; board[row][column]=' '; break;
						case 'R': board[row1][column1]='R'; board[row][column]=' '; break;
						default: cout<<"Wrong Choice"<<endl<<endl; goto cell;
					}
				}
			}
		}
		else if (row==7 && row1==row-2 && column1==column)                                                                                           // Moves 2 Boxes Up
		{
			if (board[row1][column1]!=' ' || board[row1+1][column1]!=' ')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else 
			{	if(board[row1][column1+1]=='p' || board[row1][column1-1]=='p')
				{	x=board[row1][column1]; board[row1][column1]='P'; board[row][column]=' '; pawn[1][column1-1]='!'; 
					if (check(turn))
					{ board[row1][column1]=x; board[row][column]='P'; pawn[1][column1-1]=' '; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
				}
				else
				{	x=board[row1][column1]; board[row1][column1]='P'; board[row][column]=' ';
					if (check(turn))
					{ board[row1][column1]=x; board[row][column]='P'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
				}
			}
		}
		else if (row1==row-1 && column1==column-1 && board[row1][column1]!=' ')                                                                      // Cuts Left Piece
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
			    board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='P'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='P'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
				if (row1==1)                                                                                                                        // Promotion
				{
					cell1:
					cout<<"Congratulations, Your Pawn Has Been Promoted\n Chose Your Promotion(Q or B or N or R): ";
					char prom;
					cin>>prom;
					switch (prom)
					{
						case 'Q': board[row1][column1]='Q'; board[row][column]=' '; break;
						case 'B': board[row1][column1]='B'; board[row][column]=' '; break;
						case 'N': board[row1][column1]='N'; board[row][column]=' '; break;
						case 'R': board[row1][column1]='R'; board[row][column]=' '; break;
						default: cout<<"Wrong Choice"<<endl<<endl; goto cell1;
					}
				} 
			}
		}
		else if (row==4 && row1==row-1 && column1==column-1 && board[row1][column1]==' ')                                                            // Left En Passant
		{
			if(board[row][column1]=='p' && pawn[0][column1-1]=='!')
			{	x=board[row1][column1]; board[row1][column1]='P'; board[row][column1]=' '; board[row][column]=' '; 
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='P'; board[row][column1]='p'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
			else
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
		}
		else if (row1==row-1 && column1==column+1 && board[row1][column1]!=' ')                                                                      // Cuts Right Piece
		{
			if (board[row1][column1]=='P' || board[row1][column1]=='R' || board[row1][column1]=='N' || 
			    board[row1][column1]=='B' || board[row1][column1]=='Q' || board[row1][column1]=='K')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='P'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='P'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
				if (row1==1)                                                                                                                        // Promotion
				{
					cell2:
					cout<<"Congratulations, Your Pawn Has Been Promoted\n Chose Your Promotion(Q or B or N or R): ";
					char prom;
					cin>>prom;
					switch (prom)
					{
						case 'Q': board[row1][column1]='Q'; board[row][column]=' '; break;
						case 'B': board[row1][column1]='B'; board[row][column]=' '; break;
						case 'N': board[row1][column1]='N'; board[row][column]=' '; break;
						case 'R': board[row1][column1]='R'; board[row][column]=' '; break;
						default: cout<<"Wrong Choice"<<endl<<endl; goto cell2;
					}
				} 
			}
		}
		else if (row==4 && row1==row-1 && column1==column+1 && board[row1][column1]==' ')                                                            // Right En Passant
		{
			if(board[row][column1]=='p' && pawn[0][column1-1]=='!')
			{	x=board[row1][column1]; board[row1][column1]='P'; board[row][column1]=' '; board[row][column]=' '; 
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='P'; board[row][column1]='p'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
			else
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
		}
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
void pawnb(char turn, int row, int column, int row1, int column1)      // Rules Of Black Pawns
{
	if (!((row1==row+1 && column1==column) || (row==2 && row1==row+2 && column1==column) ||                                                          // Allows Movement 
	      (row1==row+1 && column1==column-1 && board[row1][column1]!=' ') || (row1==row+1 && column1==column+1 && board[row1][column1]!=' ') ||
		  (row==5 && row1==row+1 && column1==column-1 && board[row1][column1]==' ') || (row==5 && row1==row+1 && column1==column+1 && board[row1][column1]==' ')))
	{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
	else if (turn=='Y')
	{
		if (row1==row+1 && column1==column)                                                                                                          // Moves 1 Box Down
		{
			if (board[row1][column1]!=' ')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else if (row1==8)                                                                                                                        // Promotion
			{
				cell:
				cout<<"Congratulations, Your Pawn Has Been Promoted\n Chose Your Promotion(q or b or n or r): ";
				char prom;
				cin>>prom;
				switch (prom)
				{
					case 'q': board[row1][column1]='q'; board[row][column]=' '; break;
					case 'b': board[row1][column1]='b'; board[row][column]=' '; break;
					case 'n': board[row1][column1]='n'; board[row][column]=' '; break;
					case 'r': board[row1][column1]='r'; board[row][column]=' '; break;
					default: cout<<"Wrong Choice"<<endl<<endl; goto cell;
				}
			}
			else
			{	x=board[row1][column1]; board[row1][column1]='p'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='p'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
		}
		else if (row==2 && row1==row+2 && column1==column)                                                                                           // Moves 2 Boxes Down
		{
			if (board[row1][column1]!=' ' || board[row1-1][column1]!=' ')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else 
			{	if(board[row1][column1+1]=='P' || board[row1][column1-1]=='P')
				{	x=board[row1][column1]; board[row1][column1]='p'; board[row][column]=' '; pawn[0][column1-1]='!'; 
					if (check(turn))
					{ board[row1][column1]=x; board[row][column]='p'; pawn[0][column1-1]=' '; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
				}
				else
				{	x=board[row1][column1]; board[row1][column1]='p'; board[row][column]=' ';
					if (check(turn))
					{ board[row1][column1]=x; board[row][column]='p'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
				}
			}
		}
		else if (row1==row+1 && column1==column-1 && board[row1][column1]!=' ')                                                                      // Cuts Left Piece
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
			    board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='p'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='p'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	}
				else if (row1==8)                                                                                                                    // Promotion
				{
					cell1:
					cout<<"Congratulations, Your Pawn Has Been Promoted\n Chose Your Promotion(q or b or n or r): ";
					char prom;
					cin>>prom;
					switch (prom)
					{
						case 'q': board[row1][column1]='q'; board[row][column]=' '; break;
						case 'b': board[row1][column1]='b'; board[row][column]=' '; break;
						case 'n': board[row1][column1]='n'; board[row][column]=' '; break;
						case 'r': board[row1][column1]='r'; board[row][column]=' '; break;
						default: cout<<"Wrong Choice"<<endl<<endl; goto cell1;
					}
				} 
			}
		}
		else if (row==5 && row1==row+1 && column1==column-1 && board[row1][column1]==' ')                                                            // Left En Passant
		{
			if(board[row][column1]=='P' && pawn[1][column1-1]=='!')
			{	x=board[row1][column1]; board[row1][column1]='p'; board[row][column1]=' '; board[row][column]=' '; 
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='p'; board[row][column1]='P'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
			else
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
		}
		else if (row1==row+1 && column1==column+1 && board[row1][column1]!=' ')                                                                      // Cuts Right Piece
		{
			if (board[row1][column1]=='p' || board[row1][column1]=='r' || board[row1][column1]=='n' || 
			    board[row1][column1]=='b' || board[row1][column1]=='q' || board[row1][column1]=='k')
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
			else
			{	x=board[row1][column1]; board[row1][column1]='p'; board[row][column]=' ';
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='p'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
				else if (row1==8)                                                                                                                    // Promotion
				{
					cell2:
					cout<<"Congratulations, Your Pawn Has Been Promoted\n Chose Your Promotion(q or b or n or r): ";
					char prom;
					cin>>prom;
					switch (prom)
					{
						case 'q': board[row1][column1]='q'; board[row][column]=' '; break;
						case 'b': board[row1][column1]='b'; board[row][column]=' '; break;
						case 'n': board[row1][column1]='n'; board[row][column]=' '; break;
						case 'r': board[row1][column1]='r'; board[row][column]=' '; break;
						default: cout<<"Wrong Choice"<<endl<<endl; goto cell2;
					}
				} 
			}
		}
		else if (row==5 && row1==row+1 && column1==column+1 && board[row1][column1]==' ')                                                            // Right En Passant
		{
			if(board[row][column1]=='P' && pawn[1][column1-1]=='!')
			{	x=board[row1][column1]; board[row1][column1]='p'; board[row][column1]=' '; board[row][column]=' '; 
				if (check(turn))
				{ board[row1][column1]=x; board[row][column]='p'; board[row][column1]='P'; cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn();	} 
			}
			else
			{	cout<<"Wrong Cell, Please Try Again"<<endl<<endl; player_turn(); }
		}
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
bool check(char turn)                                                  // Checks For Check
{
	for(int row2=1; row2<9; row2++)
	{
		for(int column2=1; column2<9; column2++)
		{
			if (turn=='X' && board[row2][column2]=='K')                // Searches Board For White King
			{
				if (board[row2+1][column2]=='r' || board[row2+2][column2]=='r' || board[row2+3][column2]=='r' || board[row2+4][column2]=='r' ||         // Check From Below Rook 
				    board[row2+5][column2]=='r' || board[row2+6][column2]=='r' || board[row2+7][column2]=='r')
				{
					if (board[row2+1][column2]=='r')                                                                                                
					{	return true; }
					else if (board[row2+2][column2]=='r' && board[row2+1][column2]==' ')
					{	return true; }
					else if (board[row2+3][column2]=='r' && board[row2+1][column2]==' ' && board[row2+2][column2]==' ')
					{	return true; }
					else if (board[row2+4][column2]=='r' && board[row2+1][column2]==' ' && board[row2+2][column2]==' ' && 
					         board[row2+3][column2]==' ')
					{	return true; }
					else if (board[row2+5][column2]=='r' && board[row2+1][column2]==' ' && board[row2+2][column2]==' ' && 
					         board[row2+3][column2]==' ' && board[row2+4][column2]==' ')
					{	return true; }
					else if (board[row2+6][column2]=='r' && board[row2+1][column2]==' ' && board[row2+2][column2]==' ' && 
					         board[row2+3][column2]==' ' && board[row2+4][column2]==' ' && board[row2+5][column2]==' ')
					{	return true; }
					else if (board[row2+7][column2]=='r' && board[row2+1][column2]==' ' && board[row2+2][column2]==' ' && 
					         board[row2+3][column2]==' ' && board[row2+4][column2]==' ' && board[row2+5][column2]==' ' && 
							 board[row2+6][column2]==' ')
					{	return true; }
				}
				if(board[row2-1][column2]=='r' || board[row2-2][column2]=='r' || board[row2-3][column2]=='r' || board[row2-4][column2]=='r' ||          // Check From Above Rook  
				   board[row2-5][column2]=='r' || board[row2-6][column2]=='r' || board[row2-7][column2]=='r')
				{
					if (board[row2-1][column2]=='r')
					{	return true; }
					else if (board[row2-2][column2]=='r' && board[row2-1][column2]==' ')
					{	return true; }
					else if (board[row2-3][column2]=='r' && board[row2-1][column2]==' ' && board[row2-2][column2]==' ')
					{	return true; }
					else if (board[row2-4][column2]=='r' && board[row2-1][column2]==' ' && board[row2-2][column2]==' ' && 
					         board[row2-3][column2]==' ')
					{	return true; }
					else if (board[row2-5][column2]=='r' && board[row2-1][column2]==' ' && board[row2-2][column2]==' ' && 
					         board[row2-3][column2]==' ' && board[row2-4][column2]==' ')
					{	return true; }
					else if (board[row2-6][column2]=='r' && board[row2-1][column2]==' ' && board[row2-2][column2]==' ' && 
					         board[row2-3][column2]==' ' && board[row2-4][column2]==' ' && board[row2-5][column2]==' ')
					{	return true; }
					else if (board[row2-7][column2]=='r' && board[row2-1][column2]==' ' && board[row2-2][column2]==' ' && 
					         board[row2-3][column2]==' ' && board[row2-4][column2]==' ' && board[row2-5][column2]==' ' && 
							 board[row2-6][column2]==' ')
					{	return true; }
				}
				if(board[row2][column2+1]=='r' || board[row2][column2+2]=='r' || board[row2][column2+3]=='r' || board[row2][column2+4]=='r' ||          // Check From Right Rook  
				   board[row2][column2+5]=='r' || board[row2][column2+6]=='r' || board[row2][column2+7]=='r')
				{
					if (board[row2][column2+1]=='r')
					{	return true; }
					else if (board[row2][column2+2]=='r' && board[row2][column2+1]==' ')
					{	return true; }
					else if (board[row2][column2+3]=='r' && board[row2][column2+1]==' ' && board[row2][column2+2]==' ')
					{	return true; }
					else if (board[row2][column2+4]=='r' && board[row2][column2+1]==' ' && board[row2][column2+2]==' ' && 
					         board[row2][column2+3]==' ')
					{	return true; }
					else if (board[row2][column2+5]=='r' && board[row2][column2+1]==' ' && board[row2][column2+2]==' ' && 
					         board[row2][column2+3]==' ' && board[row2][column2+4]==' ')
					{	return true; }
					else if (board[row2][column2+6]=='r' && board[row2][column2+1]==' ' && board[row2][column2+2]==' ' && 
					         board[row2][column2+3]==' ' && board[row2][column2+4]==' ' && board[row2][column2+5]==' ')
					{	return true; }
					else if (board[row2][column2+7]=='r' && board[row2][column2+1]==' ' && board[row2][column2+2]==' ' && 
					         board[row2][column2+3]==' ' && board[row2][column2+4]==' ' && board[row2][column2+5]==' ' && 
							 board[row2][column2+6]==' ')
					{	return true; }
				}
				if(board[row2][column2-1]=='r' || board[row2][column2-2]=='r' || board[row2][column2-3]=='r' || board[row2][column2-4]=='r' ||          // Check From Left Rook 
				   board[row2][column2-5]=='r' || board[row2][column2-6]=='r' || board[row2][column2-7]=='r')
				{
					if (board[row2][column2-1]=='r')
					{	return true; }
					else if (board[row2][column2-2]=='r' && board[row2][column2-1]==' ')
					{	return true; }
					else if (board[row2][column2-3]=='r' && board[row2][column2-1]==' ' && board[row2][column2-2]==' ')
					{	return true; }
					else if (board[row2][column2-4]=='r' && board[row2][column2-1]==' ' && board[row2][column2-2]==' ' && 
					         board[row2][column2-3]==' ')
					{	return true; }
					else if (board[row2][column2-5]=='r' && board[row2][column2-1]==' ' && board[row2][column2-2]==' ' && 
					         board[row2][column2-3]==' ' && board[row2][column2-4]==' ')
					{	return true; }
					else if (board[row2][column2-6]=='r' && board[row2][column2-1]==' ' && board[row2][column2-2]==' ' && 
					         board[row2][column2-3]==' ' && board[row2][column2-4]==' ' && board[row2][column2-5]==' ')
					{	return true; }
					else if (board[row2][column2-7]=='r' && board[row2][column2-1]==' ' && board[row2][column2-2]==' ' && 
					         board[row2][column2-3]==' ' && board[row2][column2-4]==' ' && board[row2][column2-5]==' ' && 
							 board[row2][column2-6]==' ')
					{	return true; }
				}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
if (board[row2+1][column2+1]=='b' || board[row2+2][column2+2]=='b' || board[row2+3][column2+3]=='b' || board[row2+4][column2+4]=='b' || // Check From Right-Down Bishop 
				    board[row2+5][column2+5]=='b' || board[row2+6][column2+6]=='b' || board[row2+7][column2+7]=='b')
				{
					if (board[row2+1][column2+1]=='b')
					{	return true; }
					else if (board[row2+2][column2+2]=='b' && board[row2+1][column2+1]==' ')
					{	return true; }
					else if (board[row2+3][column2+3]=='b' && board[row2+1][column2+1]==' ' && board[row2+2][column2+2]==' ')
					{	return true; }
					else if (board[row2+4][column2+4]=='b' && board[row2+1][column2+1]==' ' && board[row2+2][column2+2]==' ' && 
					         board[row2+3][column2+3]==' ')
					{	return true; }
					else if (board[row2+5][column2+5]=='b' && board[row2+1][column2+1]==' ' && board[row2+2][column2+2]==' ' && 
					         board[row2+3][column2+3]==' ' && board[row2+4][column2+4]==' ')
					{	return true; }
					else if (board[row2+6][column2+6]=='b' && board[row2+1][column2+1]==' ' && board[row2+2][column2+2]==' ' && 
					         board[row2+3][column2+3]==' ' && board[row2+4][column2+4]==' ' && board[row2+5][column2+5]==' ')
					{	return true; }
					else if (board[row2+7][column2+7]=='b' && board[row2+1][column2+1]==' ' && board[row2+2][column2+2]==' ' && 
					         board[row2+3][column2+3]==' ' && board[row2+4][column2+4]==' ' && board[row2+5][column2+5]==' ' && 
							 board[row2+6][column2+6]==' ')
					{	return true; }
				}
				if (board[row2+1][column2-1]=='b' || board[row2+2][column2-2]=='b' || board[row2+3][column2-3]=='b' || board[row2+4][column2-4]=='b' || // Check From Left-Down Bishop 
				    board[row2+5][column2-5]=='b' || board[row2+6][column2-6]=='b' || board[row2+7][column2-7]=='b')
				{
					if (board[row2+1][column2-1]=='b')
					{	return true; }
					else if (board[row2+2][column2-2]=='b' && board[row2+1][column2-1]==' ')
					{	return true; }
					else if (board[row2+3][column2-3]=='b' && board[row2+1][column2-1]==' ' && board[row2+2][column2-2]==' ')
					{	return true; }
					else if (board[row2+4][column2-4]=='b' && board[row2+1][column2-1]==' ' && board[row2+2][column2-2]==' ' && 
					         board[row2+3][column2-3]==' ')
					{	return true; }
					else if (board[row2+5][column2-5]=='b' && board[row2+1][column2-1]==' ' && board[row2+2][column2-2]==' ' && 
					         board[row2+3][column2-3]==' ' && board[row2+4][column2-4]==' ')
					{	return true; }
					else if (board[row2+6][column2-6]=='b' && board[row2+1][column2-1]==' ' && board[row2+2][column2-2]==' ' && 
					         board[row2+3][column2-3]==' ' && board[row2+4][column2-4]==' ' && board[row2+5][column2-5]==' ')
					{	return true; }
					else if (board[row2+7][column2-7]=='b' && board[row2+1][column2-1]==' ' && board[row2+2][column2-2]==' ' && 
					         board[row2+3][column2-3]==' ' && board[row2+4][column2-4]==' ' && board[row2+5][column2-5]==' ' && 
							 board[row2+6][column2-6]==' ')
					{	return true; }
				}
				if (board[row2-1][column2+1]=='b' || board[row2-2][column2+2]=='b' || board[row2-3][column2+3]=='b' || board[row2-4][column2+4]=='b' || // Check From Right-Up Bishop 
				    board[row2-5][column2+5]=='b' || board[row2-6][column2+6]=='b' || board[row2-7][column2+7]=='b')
				{
					if (board[row2-1][column2+1]=='b')
					{	return true; }
					else if (board[row2-2][column2+2]=='b' && board[row2-1][column2+1]==' ')
					{	return true; }
					else if (board[row2-3][column2+3]=='b' && board[row2-1][column2+1]==' ' && board[row2-2][column2+2]==' ')
					{	return true; }
					else if (board[row2-4][column2+4]=='b' && board[row2-1][column2+1]==' ' && board[row2-2][column2+2]==' ' && 
					         board[row2-3][column2+3]==' ')
					{	return true; }
					else if (board[row2-5][column2+5]=='b' && board[row2-1][column2+1]==' ' && board[row2-2][column2+2]==' ' && 
					         board[row2-3][column2+3]==' ' && board[row2-4][column2+4]==' ')
					{	return true; }
					else if (board[row2-6][column2+6]=='b' && board[row2-1][column2+1]==' ' && board[row2-2][column2+2]==' ' && 
					         board[row2-3][column2+3]==' ' && board[row2-4][column2+4]==' ' && board[row2-5][column2+5]==' ')
					{	return true; }
					else if (board[row2-7][column2+7]=='b' && board[row2-1][column2+1]==' ' && board[row2-2][column2+2]==' ' && 
					         board[row2-3][column2+3]==' ' && board[row2-4][column2+4]==' ' && board[row2-5][column2+5]==' ' && 
							 board[row2-6][column2+6]==' ')
					{	return true; }
				}
				if (board[row2-1][column2-1]=='b' || board[row2-2][column2-2]=='b' || board[row2-3][column2-3]=='b' || board[row2-4][column2-4]=='b' || // Check From Left-Up Bishop 
				    board[row2-5][column2-5]=='b' || board[row2-6][column2-6]=='b' || board[row2-7][column2-7]=='b')
				{
					if (board[row2-1][column2-1]=='b')
					{	return true; }
					else if (board[row2-2][column2-2]=='b' && board[row2-1][column2-1]==' ')
					{	return true; }
					else if (board[row2-3][column2-3]=='b' && board[row2-1][column2-1]==' ' && board[row2-2][column2-2]==' ')
					{	return true; }
					else if (board[row2-4][column2-4]=='b' && board[row2-1][column2-1]==' ' && board[row2-2][column2-2]==' ' && 
					         board[row2-3][column2-3]==' ')
					{	return true; }
					else if (board[row2-5][column2-5]=='b' && board[row2-1][column2-1]==' ' && board[row2-2][column2-2]==' ' && 
					         board[row2-3][column2-3]==' ' && board[row2-4][column2-4]==' ')
					{	return true; }
					else if (board[row2-6][column2-6]=='b' && board[row2-1][column2-1]==' ' && board[row2-2][column2-2]==' ' && 
					         board[row2-3][column2-3]==' ' && board[row2-4][column2-4]==' ' && board[row2-5][column2-5]==' ')
					{	return true; }
					else if (board[row2-7][column2-7]=='b' && board[row2-1][column2-1]==' ' && board[row2-2][column2-2]==' ' && 
					         board[row2-3][column2-3]==' ' && board[row2-4][column2-4]==' ' && board[row2-5][column2-5]==' ' && 
							 board[row2-6][column2-6]==' ')
					{	return true; }
				}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
if (board[row2+1][column2]=='q' || board[row2+2][column2]=='q' || board[row2+3][column2]=='q' || board[row2+4][column2]=='q' ||         // Check From Below Queen 
				    board[row2+5][column2]=='q' || board[row2+6][column2]=='q' || board[row2+7][column2]=='q')
				{
					if (board[row2+1][column2]=='q')
					{	return true; }
					else if (board[row2+2][column2]=='q' && board[row2+1][column2]==' ')
					{	return true; }
					else if (board[row2+3][column2]=='q' && board[row2+1][column2]==' ' && board[row2+2][column2]==' ')
					{	return true; }
					else if (board[row2+4][column2]=='q' && board[row2+1][column2]==' ' && board[row2+2][column2]==' ' && 
					         board[row2+3][column2]==' ')
					{	return true; }
					else if (board[row2+5][column2]=='q' && board[row2+1][column2]==' ' && board[row2+2][column2]==' ' && 
					         board[row2+3][column2]==' ' && board[row2+4][column2]==' ')
					{	return true; }
					else if (board[row2+6][column2]=='q' && board[row2+1][column2]==' ' && board[row2+2][column2]==' ' && 
					         board[row2+3][column2]==' ' && board[row2+4][column2]==' ' && board[row2+5][column2]==' ')
					{	return true; }
					else if (board[row2+7][column2]=='q' && board[row2+1][column2]==' ' && board[row2+2][column2]==' ' && 
					         board[row2+3][column2]==' ' && board[row2+4][column2]==' ' && board[row2+5][column2]==' ' && 
							 board[row2+6][column2]==' ')
					{	return true; }
				}
				if(board[row2-1][column2]=='q' || board[row2-2][column2]=='q' || board[row2-3][column2]=='q' || board[row2-4][column2]=='q' ||          // Check From Above Queen 
				   board[row2-5][column2]=='q' || board[row2-6][column2]=='q' || board[row2-7][column2]=='q')
				{
					if (board[row2-1][column2]=='q')
					{	return true; }
					else if (board[row2-2][column2]=='q' && board[row2-1][column2]==' ')
					{	return true; }
					else if (board[row2-3][column2]=='q' && board[row2-1][column2]==' ' && board[row2-2][column2]==' ')
					{	return true; }
					else if (board[row2-4][column2]=='q' && board[row2-1][column2]==' ' && board[row2-2][column2]==' ' && 
					         board[row2-3][column2]==' ')
					{	return true; }
					else if (board[row2-5][column2]=='q' && board[row2-1][column2]==' ' && board[row2-2][column2]==' ' && 
					         board[row2-3][column2]==' ' && board[row2-4][column2]==' ')
					{	return true; }
					else if (board[row2-6][column2]=='q' && board[row2-1][column2]==' ' && board[row2-2][column2]==' ' && 
					         board[row2-3][column2]==' ' && board[row2-4][column2]==' ' && board[row2-5][column2]==' ')
					{	return true; }
					else if (board[row2-7][column2]=='q' && board[row2-1][column2]==' ' && board[row2-2][column2]==' ' && 
					         board[row2-3][column2]==' ' && board[row2-4][column2]==' ' && board[row2-5][column2]==' ' && 
							 board[row2-6][column2]==' ')
					{	return true; }
				}
				if(board[row2][column2+1]=='q' || board[row2][column2+2]=='q' || board[row2][column2+3]=='q' || board[row2][column2+4]=='q' ||          // Check From Right Queen 
				   board[row2][column2+5]=='q' || board[row2][column2+6]=='q' || board[row2][column2+7]=='q')
				{
					if (board[row2][column2+1]=='q')
					{	return true; }
					else if (board[row2][column2+2]=='q' && board[row2][column2+1]==' ')
					{	return true; }
					else if (board[row2][column2+3]=='q' && board[row2][column2+1]==' ' && board[row2][column2+2]==' ')
					{	return true; }
					else if (board[row2][column2+4]=='q' && board[row2][column2+1]==' ' && board[row2][column2+2]==' ' && 
					         board[row2][column2+3]==' ')
					{	return true; }
					else if (board[row2][column2+5]=='q' && board[row2][column2+1]==' ' && board[row2][column2+2]==' ' && 
					         board[row2][column2+3]==' ' && board[row2][column2+4]==' ')
					{	return true; }
					else if (board[row2][column2+6]=='q' && board[row2][column2+1]==' ' && board[row2][column2+2]==' ' && 
					         board[row2][column2+3]==' ' && board[row2][column2+4]==' ' && board[row2][column2+5]==' ')
					{	return true; }
					else if (board[row2][column2+7]=='q' && board[row2][column2+1]==' ' && board[row2][column2+2]==' ' && 
					         board[row2][column2+3]==' ' && board[row2][column2+4]==' ' && board[row2][column2+5]==' ' && 
							 board[row2][column2+6]==' ')
					{	return true; }
				}
				if(board[row2][column2-1]=='q' || board[row2][column2-2]=='q' || board[row2][column2-3]=='q' || board[row2][column2-4]=='q' ||          // Check From Left Queen 
				   board[row2][column2-5]=='q' || board[row2][column2-6]=='q' || board[row2][column2-7]=='q')
				{
					if (board[row2][column2-1]=='q')
					{	return true; }
					else if (board[row2][column2-2]=='q' && board[row2][column2-1]==' ')
					{	return true; }
					else if (board[row2][column2-3]=='q' && board[row2][column2-1]==' ' && board[row2][column2-2]==' ')
					{	return true; }
					else if (board[row2][column2-4]=='q' && board[row2][column2-1]==' ' && board[row2][column2-2]==' ' && 
					         board[row2][column2-3]==' ')
					{	return true; }
					else if (board[row2][column2-5]=='q' && board[row2][column2-1]==' ' && board[row2][column2-2]==' ' && 
					         board[row2][column2-3]==' ' && board[row2][column2-4]==' ')
					{	return true; }
					else if (board[row2][column2-6]=='q' && board[row2][column2-1]==' ' && board[row2][column2-2]==' ' && 
					         board[row2][column2-3]==' ' && board[row2][column2-4]==' ' && board[row2][column2-5]==' ')
					{	return true; }
					else if (board[row2][column2-7]=='q' && board[row2][column2-1]==' ' && board[row2][column2-2]==' ' && 
					         board[row2][column2-3]==' ' && board[row2][column2-4]==' ' && board[row2][column2-5]==' ' && 
							 board[row2][column2-6]==' ')
					{	return true; }
				}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
if (board[row2+1][column2+1]=='q' || board[row2+2][column2+2]=='q' || board[row2+3][column2+3]=='q' || board[row2+4][column2+4]=='q' || // Check From Right-Down Queen 
				    board[row2+5][column2+5]=='q' || board[row2+6][column2+6]=='q' || board[row2+7][column2+7]=='q')
				{
					if (board[row2+1][column2+1]=='q')
					{	return true; }
					else if (board[row2+2][column2+2]=='q' && board[row2+1][column2+1]==' ')
					{	return true; }
					else if (board[row2+3][column2+3]=='q' && board[row2+1][column2+1]==' ' && board[row2+2][column2+2]==' ')
					{	return true; }
					else if (board[row2+4][column2+4]=='q' && board[row2+1][column2+1]==' ' && board[row2+2][column2+2]==' ' && 
					         board[row2+3][column2+3]==' ')
					{	return true; }
					else if (board[row2+5][column2+5]=='q' && board[row2+1][column2+1]==' ' && board[row2+2][column2+2]==' ' && 
					         board[row2+3][column2+3]==' ' && board[row2+4][column2+4]==' ')
					{	return true; }
					else if (board[row2+6][column2+6]=='q' && board[row2+1][column2+1]==' ' && board[row2+2][column2+2]==' ' && 
					         board[row2+3][column2+3]==' ' && board[row2+4][column2+4]==' ' && board[row2+5][column2+5]==' ')
					{	return true; }
					else if (board[row2+7][column2+7]=='q' && board[row2+1][column2+1]==' ' && board[row2+2][column2+2]==' ' && 
					         board[row2+3][column2+3]==' ' && board[row2+4][column2+4]==' ' && board[row2+5][column2+5]==' ' && 
							 board[row2+6][column2+6]==' ')
					{	return true; }
				}
				if (board[row2+1][column2-1]=='q' || board[row2+2][column2-2]=='q' || board[row2+3][column2-3]=='q' || board[row2+4][column2-4]=='q' || // Check From Left-Down Queen 
				    board[row2+5][column2-5]=='q' || board[row2+6][column2-6]=='q' || board[row2+7][column2-7]=='q')
				{
					if (board[row2+1][column2-1]=='q')
					{	return true; }
					else if (board[row2+2][column2-2]=='q' && board[row2+1][column2-1]==' ')
					{	return true; }
					else if (board[row2+3][column2-3]=='q' && board[row2+1][column2-1]==' ' && board[row2+2][column2-2]==' ')
					{	return true; }
					else if (board[row2+4][column2-4]=='q' && board[row2+1][column2-1]==' ' && board[row2+2][column2-2]==' ' && 
					         board[row2+3][column2-3]==' ')
					{	return true; }
					else if (board[row2+5][column2-5]=='q' && board[row2+1][column2-1]==' ' && board[row2+2][column2-2]==' ' && 
					         board[row2+3][column2-3]==' ' && board[row2+4][column2-4]==' ')
					{	return true; }
					else if (board[row2+6][column2-6]=='q' && board[row2+1][column2-1]==' ' && board[row2+2][column2-2]==' ' && 
					         board[row2+3][column2-3]==' ' && board[row2+4][column2-4]==' ' && board[row2+5][column2-5]==' ')
					{	return true; }
					else if (board[row2+7][column2-7]=='q' && board[row2+1][column2-1]==' ' && board[row2+2][column2-2]==' ' && 
					         board[row2+3][column2-3]==' ' && board[row2+4][column2-4]==' ' && board[row2+5][column2-5]==' ' && 
							 board[row2+6][column2-6]==' ')
					{	return true; }
				}
				if (board[row2-1][column2+1]=='q' || board[row2-2][column2+2]=='q' || board[row2-3][column2+3]=='q' || board[row2-4][column2+4]=='q' || // Check From Right-Up Queen 
				    board[row2-5][column2+5]=='q' || board[row2-6][column2+6]=='q' || board[row2-7][column2+7]=='q')
				{
					if (board[row2-1][column2+1]=='q')
					{	return true; }
					else if (board[row2-2][column2+2]=='q' && board[row2-1][column2+1]==' ')
					{	return true; }
					else if (board[row2-3][column2+3]=='q' && board[row2-1][column2+1]==' ' && board[row2-2][column2+2]==' ')
					{	return true; }
					else if (board[row2-4][column2+4]=='q' && board[row2-1][column2+1]==' ' && board[row2-2][column2+2]==' ' && 
					         board[row2-3][column2+3]==' ')
					{	return true; }
					else if (board[row2-5][column2+5]=='q' && board[row2-1][column2+1]==' ' && board[row2-2][column2+2]==' ' && 
					         board[row2-3][column2+3]==' ' && board[row2-4][column2+4]==' ')
					{	return true; }
					else if (board[row2-6][column2+6]=='q' && board[row2-1][column2+1]==' ' && board[row2-2][column2+2]==' ' && 
					         board[row2-3][column2+3]==' ' && board[row2-4][column2+4]==' ' && board[row2-5][column2+5]==' ')
					{	return true; }
					else if (board[row2-7][column2+7]=='q' && board[row2-1][column2+1]==' ' && board[row2-2][column2+2]==' ' && 
					         board[row2-3][column2+3]==' ' && board[row2-4][column2+4]==' ' && board[row2-5][column2+5]==' ' && 
							 board[row2-6][column2+6]==' ')
					{	return true; }
				}
				if (board[row2-1][column2-1]=='q' || board[row2-2][column2-2]=='q' || board[row2-3][column2-3]=='q' || board[row2-4][column2-4]=='q' || // Check From Left-Up Queen 
				    board[row2-5][column2-5]=='q' || board[row2-6][column2-6]=='q' || board[row2-7][column2-7]=='q')
				{
					if (board[row2-1][column2-1]=='q')
					{	return true; }
					else if (board[row2-2][column2-2]=='q' && board[row2-1][column2-1]==' ')
					{	return true; }
					else if (board[row2-3][column2-3]=='q' && board[row2-1][column2-1]==' ' && board[row2-2][column2-2]==' ')
					{	return true; }
					else if (board[row2-4][column2-4]=='q' && board[row2-1][column2-1]==' ' && board[row2-2][column2-2]==' ' && 
					         board[row2-3][column2-3]==' ')
					{	return true; }
					else if (board[row2-5][column2-5]=='q' && board[row2-1][column2-1]==' ' && board[row2-2][column2-2]==' ' && 
					         board[row2-3][column2-3]==' ' && board[row2-4][column2-4]==' ')
					{	return true; }
					else if (board[row2-6][column2-6]=='q' && board[row2-1][column2-1]==' ' && board[row2-2][column2-2]==' ' && 
					         board[row2-3][column2-3]==' ' && board[row2-4][column2-4]==' ' && board[row2-5][column2-5]==' ')
					{	return true; }
					else if (board[row2-7][column2-7]=='q' && board[row2-1][column2-1]==' ' && board[row2-2][column2-2]==' ' && 
					         board[row2-3][column2-3]==' ' && board[row2-4][column2-4]==' ' && board[row2-5][column2-5]==' ' && 
							 board[row2-6][column2-6]==' ')
					{	return true; }
				}
Pages: 12