-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChessHeader.cpp
More file actions
234 lines (234 loc) · 7.84 KB
/
Copy pathChessHeader.cpp
File metadata and controls
234 lines (234 loc) · 7.84 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
//#include <iostream>
//#include <iomanip>
//#include<cstdlib>
//#include<ctime>
//#include <windows.h>
//void start();
//void chessboard();
//void queenmovement(char [][8],int,int,int,int,int);
//using namespace std;
//
//int main()
//{
// start();
//
// return 0;
// }
//void start() {
// char choice;
// int quotes;
// srand(time(0));
// quotes = (rand() % 8) + 1;
// ////////////////////////////////////////////////////////////////Starting Interface//////////////////////////////////////////////////////////////
// cout << "***********************************************************************************************************************";
// cout << setw(80) << " _____ _ _ _____ _____ _____\n";
// cout << setw(80) << " / ____| | | | | | ____| / ____| / ____|\n";
// cout << setw(81) << "| | | |__| | | |__ | (___ | (___ \n";
// cout << setw(80) << "| | | __ | | __| \\___ \\ \\___ \\ \n";
// cout << setw(80) << "| |____ | | | | | |___ ____)| ____)|\n";
// cout << setw(46) << " \\_____| " << " |_| |_| |_____| |_____/ |_____/ \n";
// cout << "***********************************************************************************************************************" << endl << endl << endl;
// cout << "Menu: " << endl << endl << endl;
// cout << "(N)ew game" << endl;
// cout << "(Q)uit" << endl;
// cout << "Enter your choice: ";
// cin >> choice;
// if (choice == 'N' || choice == 'n') {
// chessboard();
// }
//
//}
//void chessboard() {
// const int s = 8;
// int initialrow, initialcolumn, nextrow, nextcolumn;
// bool b = 1;
//
// char board[s][s] = {
// {'r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'},
// {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
// {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
// {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
// {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
// {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
// {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
// {'R', 'N', 'B', 'Q', 'K', 'B', 'N', 'R'}
// };
//
// // Display the board
//
// while (b)
// {
//
// cout << endl << endl << endl;
// for (int i = 0; i < s + 1; i++) {
// for (int j = 0; j < s + 1; j++) {
// if (i == 0) {
// if (j == 8)
// cout << " ";
// else if (i == 0)
// cout << "\t" << j;
// }
// else if (j == 0) {
// cout << endl << i - 1 << "\t";
// }
// if (i > 0 && j > 0)
// cout << board[i - 1][j - 1] << "\t";
// }
// if (i == 0)
// cout << endl;
// else
// cout << endl << endl;
// }
// ////////Taking input for movemennt ///
// cout << "Enter the coordinates of the chess piece you want to move respectively(i.e 02): ";
// cin >> initialrow >> initialcolumn;
// cout << "Enter the coordinates of the chess piece you want to move respectively(i.e 04): ";
// cin >> nextrow >> nextcolumn;
//
//
// system("cls");
// }
// if (board[initialrow][initialcolumn] == 'Q') {//|| board[initialrow][initialcolumn] == 'k') {
// queenmovement(board, initialrow, initialcolumn, nextrow, nextcolumn,s);
// }
//}
//void queenmovement(char board[][8], int initialrow, int initialcolumn, int nextrow, int nextcolumn, int s) {
// char s1;
// if ((board[nextrow][nextcolumn]=='K'&& board[nextrow][nextcolumn] == 'R'&& board[nextrow][nextcolumn] == 'N'&& board[nextrow][nextcolumn] == 'B')&&(initialrow >= 0 && initialrow <= 7 && initialcolumn >= 0 && initialcolumn <= 7 && nextrow >= 0 && nextrow <= 7 && nextcolumn >= 0 && nextcolumn <= 7) && (initialrow == nextrow || initialcolumn == nextcolumn || initialcolumn - initialrow == nextrow - nextcolumn || initialcolumn + initialrow == nextrow + nextcolumn))
// {
// s1 = board[nextrow][nextcolumn];
// board[nextrow][nextcolumn] = board[initialrow][initialcolumn];
// if (board[nextrow][nextcolumn] == ' ')
// board[initialrow][initialcolumn] = s1;
// else if (board[nextrow][nextcolumn] != ' ')
// board[initialrow][initialcolumn] = ' ';
// cout << endl << endl << endl;
// for (int i = 0; i < s + 1; i++) {
// for (int j = 0; j < s + 1; j++) {
// if (i == 0) {
// if (j == 8)
// cout << " ";
// else if (i == 0)
// cout << "\t" << j;
// }
// else if (j == 0) {
// cout << endl << i - 1 << "\t";
// }
// if (i > 0 && j > 0)
// cout << board[i - 1][j - 1] << "\t";
// }
// if (i == 0)
// {
// cout << endl;
// }
// else
// {
// cout << endl << endl;
// }
// }
// }
// else
// cout << endl << "Invalid Coordinates!";
//}
//
//
////////#include <iostream>
////////using namespace std;
////////void start();
////////void yournextmove();
////////bool savetheking();
////////bool move_validity_check(char[][], 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 c_pieces[8][8], int prev_x, int prev_y, int new_x, int new_y)
////////{
//////// if (prev_x < 0 || prev_x>7)
//////// return false;
////////}