Hi, I am trying to develop the following code for an assignment, but I am stuck! It is a game which is played by two people using circular game pieces (checkers), and the reds move first (other uses black); initially the board is empty. The reds involve adding on additional red game piece to the board as well as the opponent. They alternate. We have to consider a game board of 8x8 ( row and column numbers for array connectBoard[8][8]. When it is time for a player to move, they indicate the column it should be placed. When the column contains no game pieces, it is placed in the bottommost row (row with largest number).The board would become R's and B's for each respective player's color.
Other conditions include: -When player places the piece in a column containing other, it is put in the largest row not containing a piece.
-We have to include other special cases.
#include <iostream>
using namespace std;
int i;
int numRowsInBoard;
int columnChosen;
int **myConnectNBoard;
bool InitializeBoard(int**connectNBoard, int numRowsInBoard);
bool MakeMove(int**connectNBoard, int numRowsInBoard, int player, int columnChosen);
bool DisplayBoard(int**connetNBoard, int numRowsInBoard);
bool CheckWinner(int**connectNBoard, int numRowsInBoard, int numConnect, int columnChose, int player);
int main ()
{
int**connectNBoard;
int numRowsInBoard;
int player;
int numToConnect;
int numConnect;
cout<<"Please input the size of the board in order to determine row length.\n";
cin>>numRowsInBoard;
if ((8<=numRowsInBoard)&&(numRowsInBoard<=25))
{
cerr<<"ERROR: Illegal value entered! Please input a value between 8 and 25; .\n";
cin>>numRowsInBoard;
}
cout<<"Please read the number of game pieces in a row that are needed to win present game.\n";
cin>>numToConnect;
if ((i=(4<= numToConnect))&&(i<=(numRowsInBoard-4)))
{
cerr<<"ERROR: Illegal value entered! Please input a new.\n"
<<"value which is greater than 4 and less than the number of Rows-4.\n";
cin>>numToConnect;
}
InitializeBoard(connectNBoard, numRowsInBoard);
bool InitializeBoard(int**connectNBoard, int numRowsInBoard)
{
for (
{
//This is the place where we have to check to see that the board is initialized correctly using boolean values. It is implemented using the for loop and pointers with new to allocate connectNBoard?
}
}
return 0;
}
This is what I have so far...then we more instructions to follow, yet my main difficulty is using dynamic arrays to allocate and Initialize, along with pointers... any help or advice on other errors is greatly appreciated! THANK YOU! As a side note: It doesn't compile as it is! =(