-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChessAIGame.cpp
More file actions
162 lines (162 loc) · 3.49 KB
/
Copy pathChessAIGame.cpp
File metadata and controls
162 lines (162 loc) · 3.49 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
//#include <iostream>
//#include <cmath>
//using namespace std;
//void start();
//void yournextmove();
//bool savetheking();
//bool move_validity_check(char[][8], int, int, int, int);
//int main()
//{
// start();
// return 0;
//}
//void start()
//{
// int a;
// cout << "****CHESSGAME******" << endl;
// cout << "choose one of the two options" << endl;
// cout << "1) start" << endl;
// cout << "2) instructions" << endl;
// cout << "3) Exit" << endl;
// cin >> a;
// if (a == 1)
// {
// yournextmove();
// }
// else if (a == 2)
// {
// savetheking();
// }
// else if (a == 3)
// {
// cout << "program terminated!" << endl;
// exit(0);
// }
// else
// cout << "Invalid option!!, choose either 1,2 or 3" << endl;
//}
//void yournextmove()
//{
// char arr[8][8];
// //black
// arr[0][0] = 'R';
// arr[0][1] = 'N';
// arr[0][2] = 'B';
// arr[0][3] = 'K';
// arr[0][4] = 'Q';
// arr[0][5] = 'N';
// arr[0][6] = 'B';
// arr[0][7] = 'R';
// //white
// arr[7][0] = 'r';
// arr[7][1] = 'n';
// arr[7][2] = 'b';
// arr[7][3] = 'k';
// arr[7][4] = 'q';
// arr[7][5] = 'n';
// arr[7][6] = 'b';
// arr[7][7] = 'r';
// for (int i = 1; i <= 6; i++)
// {
// for (int j = 0; j <= 7; j++)
// {
// arr[i][j] = ' ';
// }
// }
//
// for (int i = 0; i < 8; i++)
// {
// for (int j = 0; j < 8; j++)
// {
// cout << " " << arr[i][j];
// }
// cout << endl;
// }
// /*char pc;
// cout << "enter which piece you want to choose" << endl;
// cout << "for black pieces enter-:" << endl;
// cout << "enter r for rook" << endl;
// cout << "enter n for knight" << endl;
// cout << "enter b for bishop" << endl;
// cout << "enter k for king" << endl;
// cout <<"enter q for queen" << endl;
// cout << "for white pieces enter the above as capital letters" << endl;*/
// int i_row, i_col;
// int f_row, f_col;
// cout << "enter the coordinates of the chess piece you want to move" << endl;
// cin >> i_row >> i_col;
// cout << "enter the coordinates where you want to move the piece to" << endl;
// cin >> f_row >> f_col;
//
//
//}
//bool savetheking()
//{
// return true;
//}
////bool move_validity_check(char[][8], int, int, int, int)
////{
//// return false;
////}
////player1(black)
//bool move_validity_check(char c_pieces[][8], int prev_x, int prev_y, int new_x, int new_y)
//{
// if (prev_x == new_x && prev_y == new_y)
// return false;
// if (c_pieces[prev_x][prev_y] == ' ')
// return false;
// if (prev_x < 0 || new_x>7 || prev_y < 0 || new_y>7)
// return false;
// char chess_piece = c_pieces[prev_x][prev_y];
// //validating rook
// if (chess_piece == 'r')
// {
// if (prev_x != new_x && prev_y != new_y)
// return false;
// if (prev_x == new_x)
// {
// if (new_y > prev_y)
// {
// for (int j = 1 + prev_y; j < new_y; j++)
// {
// c_pieces[prev_x][j] != ' ';
// return false;
// }
// }
// else if (new_y < prev_y)
// {
// for (int i = 1 - prev_y; i > new_y; i--)
// c_pieces[prev_x][i] != ' ';
// return false;
// }
// }
// else if (prev_y == new_y)
// {
// if (new_x > prev_x)
// {
// for (int j = 1 + prev_y; j < new_y; j++)
// {
// c_pieces[j][prev_y] != ' ';
// return false;
// }
// }
// else if (new_x < prev_x)
// {
// for (int i = 1 - prev_x; i > new_x; i--)
// {
// c_pieces[prev_y][i] != ' ';
// return false;
// }
// }
// }
// }
// //validating knight
// else if (chess_piece == 'n')
// {
// if (new_x == prev_x && prev_y != new_y || new_y == prev_y && prev_x != new_x)
// return false;
// if (abs(new_y - prev_y) != abs(new_x - prev_x))
// return false;
//
// }
//}