Question
using c++ INSTRUCTIONS Input The first line of input begins with two positive integers n and m, 0 Output Your program will output 1 line
using c++
INSTRUCTIONS
Input The first line of input begins with two positive integers n and m, 0
Output Your program will output 1 line of 3 integers (each integer separated by a single space). The first two integers represent the row and column where it is best to place a white disk. The last number is the result of that placement shown as the number of total white disks - the total of black disks. If there are several locations where an additional white disk achieves the maximum number of white disks, then output the one with the minimum row number. If there are multiple columns in the smallest row number that result in the maximum number of white disks, then output the smallest such column.
SKELETON CODE
class Board { char board[SIZE][SIZE]; // each square holds 'b', 'w', or ' '
public Board() {}//initializes the board to all blanks
int count(char color) {} // returns the number of squares containing color
void set(int row, int col, char color) {} // sets the square at (row, col) to color
int resultOfMove(int row, int col, char color) {}// returns the number of color - number of other color when a disk of color is placed at(row, col)
int bestMove(int & row, int &col, char color) {} // returns the max resultOfMove(row,col) when a disk of color is placed at(row, col) };
I need my skeleton code filled out with c++ to fit the instructions
// MY CODE
#include
int bestMove(char board[][8]);
int main() { int blaPieces, whiPieces; const int SIZE = 8; char board[SIZE][SIZE]; // each square holds 'b', 'w', or ' ' //int whiteRow[32]; //int whiteColumn[32];
cout > blaPieces; cout > whiPieces;
for(int i = 0; i
cout > numX; cout > numY; board[numX - 1][numY - 1] = 'b'; }
for (int i = 0; i
cout > numX; //whiteColumn[i] = numX; cout > numY; //whiteColumn[i] = numY; board[numX - 1][numY - 1] = 'w'; }
for (int i = 0; i
// Newline for new row cout
system("pause"); return 0;
}
int bestMove(char board[][8])// returns the max resultOfMove(row,col) when a disk of color is placed at(row, col) {
for (int i = 0; i
}
//int resultOfMove(int row, int col, char color) {}// returns the number of color - number of other color when a disk of color is placed at(row, col)
im confused on how to finish it and make it work to fit the instructions i need some guidance please
c++
Sample Input Sample Output 5 8 6 1 4 1 3 1 3 2 2 3 6 2 5 1 5 2 5 3 5 4 4 2 4 3 6 38 Sample Input Sample Output 5 8 6 1 4 1 3 1 3 2 2 3 6 2 5 1 5 2 5 3 5 4 4 2 4 3 6 38
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started