Professional Documents
Culture Documents
#include <iostream>
#include <string>
#include <stdlib.h>
#include <conio.h>
#include <cstdlib>
#include <ctime>
Int rollTurn(){
Srand((unsigned) time(0));
Return rTurn;
‘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’
};
Int pathBoard [8][8] = {
‘0’,’0’,’0’,’0’,’0’,’0’,’0’,’0’,
‘0’,’0’,’0’,’0’,’0’,’0’,’0’,’0’,
‘0’,’0’,’0’,’0’,’0’,’0’,’0’,’0’,
‘0’,’0’,’0’,’0’,’0’,’0’,’0’,’0’,
‘0’,’0’,’0’,’0’,’0’,’0’,’0’,’0’,
‘0’,’0’,’0’,’0’,’0’,’0’,’0’,’0’,
‘0’,’0’,’0’,’0’,’0’,’0’,’0’,’0’,
‘0’,’0’,’0’,’0’,’0’,’0’,’0’,’0’
};
Int I;
Cout << x << “ “ << I << “ | “ << eRow << “ “ << eCol << endl;
X++;
Cout << x << “ “ << I << “ | “ << eRow << “ “ << eCol << endl;
X++;
If (cBoard[x][I – 1] != ‘-‘) return false;
}/*
x--;
x--;
}*/
Int I;
Cout << x << “ “ << I << “ | “ << eRow << “ “ << eCol << endl;
X++;
Cout << x << “ “ << I << “ | “ << eRow << “ “ << eCol << endl;
X++;
Cout << x << “ “ << I << “ | “ << eRow << “ “ << eCol << endl;
x--;
Cout << x << “ “ << I << “ | “ << eRow << “ “ << eCol << endl;
x--;
//return true;
Int I;
If (sRow == eRow) {
Else {
}
Else {
Return true;
Int I;
If (sRow == eRow) {
Else {
}
Else {
Return true;
Void showBoard(){
Int yCol1 = 8;
yCol1--;
}
Cout << “ |------------------------” << endl;
Void gInstructions(){
Cout << “Toss a coin, or pick who should go first!\n” << endl;
Cout << “Upper Case = ‘WHITE’ Pieces; Lower Case = ‘black’ Pieces” << endl;
Cout << “r = Rook, n = Knight/ Horse, q = Queen, k = King, p = Pawn\n” << endl;
Cout << “Choose a number between 11 and 88.\nNumbers outside of them will be invalidated!” <<
endl;
Void gameStart(){
gInstructions();
string pWB;
int totalTurns = 1;
int gameTurn = 0;
int sMove = 0;
int eMove = 0;
bool gPass;
showBoard();
gPass = false;
else{}
cout << “It’s “ << pWB << “’s turn!” << endl;
while (!gPass){
if (cBoard[sRow][sCol] != ‘-‘){
If (gameTurn == 0){
Switch(cBoard[sRow][sCol]){
Case ‘P’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘P’;
Break;
Case ‘N’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘N’;
Break;
Case ‘R’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘R’;
Break;
Case ‘B’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘B’;
Break;
Case ‘Q’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘Q’;
Break;
Default:
Break;
Switch(cBoard[sRow][sCol]){
Case ‘p’:
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘p’;
Break;
Case ‘n’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘n’;
Break;
Case ‘r’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘r’;
Break;
Case ‘b’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘b’;
Break;
Case ‘q’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘q’;
Break;
Default:
Break;
Else{
If (gameTurn == 0){
Switch(cBoard[sRow][sCol]){
Case ‘P’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘P’;
Break;
Case ‘N’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘N’;
Break;
Case ‘R’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘R’;
Break;
Case ‘B’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘B’;
Break;
Case ‘Q’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘Q’;
Break;
Default:
Break;
Switch(cBoard[sRow][sCol]){
Case ‘p’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘p’;
Break;
Case ‘n’:
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘n’;
Break;
Case ‘r’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘r’;
Break;
Case ‘b’:
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘b’;
Break;
Case ‘q’:
eatRook(sRow, sCol, eRow, eCol);
gPass = true;
cBoard[sRow][sCol] = ‘-‘;
cBoard[eRow][eCol] = ‘q’;
Break;
Default:
Break;
If (gameTurn != 1) {gameTurn++;}
Else {gameTurn--;}
totalTurns++;
Int main(){
//string name;
gameStart();
#include <iostream>
Int Main()
Int I, j, rows;
String b, w, t;
B = “black”;
W = “white”;
Cout << “nn Display checkerboard pattern with the words ‘black’ and ‘white’:n”;
If (j % 2 != 0)
Cout << b;
If (j < rows)
{
Cout << “-“;
Else if (j % 2 == 0)
Cout << w;
If (j < rows)
T = b;
B = w;
W = t;