I Have A Program To Play Reversi Where A User Plays Against An Ai Algorithm Howe

I have a program to play Reversi where a user plays against an AI(Algorithm), however I need a program where 2 algorithms play against each other. I don’t know how to change the program so that the 2 algorithms can play against each other.

These are the rules:

In this project you are required to:

1. Implement Reversi for a board size of n x n where 4 ≤ n ≤ 16 and n is always even.

2. Implement two different algorithms that will play Reversi against each other e.g. an algorithm that randomly chooses a valid move may be one of your algorithms.

You are required to develop a computer program in C++ that allows two different algorithms to compete against each other in a game of Reversi. Your code must meet the following specifications:

• Read in a list of numbers specifying board sizes from a file. • Every game must begin in the starting configuration as seen in figure 1. • Algorithm 1 will take alternating turns with algorithm 2 at placing their markers in the grid. • A marker cannot overwrite already filled position in the grid. • The list of moves made by each algorithm must be stored to an output file.

Figure 1:

4, 4

Example of output:

size = 4 (r=row, c=column)

r0c1 alg1 , r1c1

r0c0 alg2 , r1c1

r1c0 alg1 , r1c1

r2c0 alg2 , r1c0 r2c1

r3c1 alg1 , r2c2

r2c3 alg2 , r2c2

r3c2 alg1 , r2c2

r0c3 alg2 , r1c2

r1c3 alg1 , r1c2 r2c3

r0c2 alg2 , r0c1 r1c1

r3c0 alg1 , r2c1

r3c1 alg2 , r2c1

alg1 = 7

alg2 = 9

win = alg2

Code I have so far:

#include<fstream>

#include <string>

#include<string>

#include <iostream>

using namespace std;

const int NUM_ROWS = 8, NUM_COLS = 8;

int determine_game_type_new_or_existing();

void initialize_game_board(int gb [][NUM_COLS]);

void display_gameboard_row(unsigned int rownum, int gb [][NUM_COLS]);

void display_gameboard(int gb [][NUM_COLS]);

void display_cell_top();

void display_cell_side(char cell_middle);

int main()

{

       int player_choice = 0;

       int gameboard [NUM_ROWS][NUM_COLS];

       int player, opponent;

       player_choice = determine_game_type_new_or_existing();

       switch (player_choice)

       {

               case 1:

                       {

                               initialize_game_board(gameboard);

                               break;

                       }

               case 2:

                               return 0;

               default:

                       {

                               cout << “Invalid choice!nn”;

                               return 1;

                               break;

                       }

       }

       display_gameboard(gameboard);

       int row, col;

       cout << “Make your move.nn”

                << “Row: “;

       cin >> row;

       while (row < 0 && row > 7)

       {

               cout << “Please enter a valid move between 0-7.n”;

               cout << “Make your move.nn”

                << “Row: “;

               cin >> row;

       }

       cout << endl << endl

                << “Column: “;

       cin >> col;

       while (col < 0 && col > 7)

       {

               cout << “Please enter a valid move between 0-7.n”;

               cout << “Make your move.nn”

                << “Column: “;

               cin >> col;

       }

       return 0;

}

int determine_game_type_new_or_existing()

{

       int the_answer = 0;

       cout << “Welcome to Othello!n”

                << “———————–nn”;

       do

       {

               //Ask the question

               cout << “1. New gamen”

                        << “2. Existing gamen”

                        << “3. Quitnn”

                        << “Enter your choice: “;

               cin >> the_answer;

               cout << endl << endl;

       }while (the_answer != 1 && the_answer != 2);

       return the_answer;

}

void initialize_game_board(int gb[][NUM_COLS])

{

       //This is a nested loop to make sure every cell is empty

       //Cell Codes: 0 = empty, 1 = white piece, 2 = black piece

       for (int i = 0; i < NUM_ROWS; i++)

       {

               for (int j = 0; j < NUM_COLS; j++)

               gb[i][j] = 0;

       }

       gb[3][3] = 1;//Put down white piece

       gb[4][4] = 1;//Put down white piece

       gb[3][4] = 2;//Put down black piece

       gb[4][3] = 2;//Put down black piece

}

void display_gameboard(int gb [NUM_ROWS][NUM_COLS])

{

       for (unsigned int num = 0; num < NUM_ROWS; num++)

       {

               cout << ”    “;

               display_gameboard_row(num, gb);

       }

       cout << ”    “;

       for(unsigned int num = 0; num < NUM_COLS; num++)

               display_cell_top();//Displays a horizontal line

       cout << ‘+’ << endl;

}

void display_gameboard_row(unsigned int rownum, int gb [NUM_ROWS][NUM_COLS])

{

       for (unsigned int num = 0; num < NUM_COLS; num++)

               display_cell_top();//Displays a horizontal line

       cout << ‘+’ << endl;

       cout << ”    “;

       for (unsigned int num = 0; num < NUM_COLS; num++)

       {

               display_cell_side(‘ ‘);//Displays a vertical line

       }

       cout << ‘|’ << endl;

       cout << ”    “;

       for (unsigned int col = 0; col < NUM_COLS; col++)

       {

               //char game_piece;//Either space, W or B

               if ( gb[rownum][col] == 0 )

           display_cell_side (‘ ‘);

       else if ( gb[rownum][col] == 1 )

           display_cell_side (‘W’);

       else if ( gb[rownum][col] == 2 )

           display_cell_side (‘B’);

       else

       {

           cout << “An internal error has occurred.” << endl;

           //exit (2);

           //return 2;

       }

       }

       cout << ‘|’ << endl;

       cout << ”    “;

       for (unsigned int num = 0; num < NUM_COLS; num++)

               display_cell_side(‘ ‘);//Displays a vertical line

       cout << ‘|’ << endl;

}

void display_cell_top()

{

       string cell_top = “+——“;

       cout << cell_top;

}

void display_cell_side(char cell_middle)

{

       string cell_left_side = “|  “;

       //string cell_middle = ” “;

       string cell_right_side = ” “;

       cout << cell_left_side << cell_middle << cell_right_side;

}

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
ORDER NOW

I Have A Programming Assignment In Which I Need To Generate An Array Of Numbers

I have a programming assignment in which i need to generate an array of numbers, I have a little example, not much.

20 0 1

15 -5 2

25 -3 3

10 25 5

I can setup the arguments to prevent invalid numbers, and for print formatting/ file appending, but I cannot setup the array.

I must ask the user for three numbers:

The first number represents how many rows are to be in the table (1 to 25).

The second number represents the first value in the first column of the table. (-1000 to +1000).

And the third number represents the increment between successive values in the first column of the table. (-10 to 20).

Thank you,

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
ORDER NOW

I Have A Project Details Highlighted On Attached Document Not More Than One And

I have a project, details highlighted on attached document. Not more than one and a half pages.

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
ORDER NOW

I Have A Project Due In Marketing And Need Some Help Attached Is The Assignments

I have a project due in marketing and need some help. Attached is the assignments. It is 2 parts but has to be completed as 1. 

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
ORDER NOW

I Have A Project Due In Marketing Next Week And I Do Not Have Time To Complete I

I have a project due in Marketing next week and I do not have time to complete it. Attached is the assignment details.

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
ORDER NOW

I Have A Project Proposal To Submit On The Social And Economic Status Of Women I

I have a project proposal to submit on The Social and Economic Status of Women.  I need to address:  short term and long term sustainability applications; bleaching?  issue/how do you stop it and issue/what i learned to address short term and long term.  In project proposal, outline: The environmental  problem that is being addressed.  The proposed local solution to that problem.  The hypothesisthat the solution relies on. The experimental protocol and data collection that will test the hypothesis. Data analysis and draw conclusions.  How the proposed solution would work in a different geographical region.  2-3 pages, microsoft word, 12-pt Times New Roman, double-spaced. 

Roles of WomenManageable improvement lays on keeping up long haul financial, social and natural capital.While the significance of putting resources into financial resources for guarantee progress…

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
ORDER NOW

I Have A Project To Deliver At The End Of This Week Deb Is Driving Her Car When

I have a project to deliver at the end of this week.

Deb is driving her car when it is involved in an accident with a car driven by Abe. A few moments after the first crash, a car driven by Ann hits the two cars disabled from the first crash. Cal, a passenger in Abe’s car has a minor injury to his head from the first crash but serious injury to his knees and legs from Ann’s subsequent driving into the first crash. Cal is taken to the hospital where doctor informs him, correctly, that he will lose both legs unless he consents to an immediate particular type of surgery which my save his legs. Doctor does not inform Cal that this type of surgery, if successful, will mean that his repaired knees will need artificial replacements within the next fifteen years. Cal, no knowing about the risk of knee replacement, agrees to the surgery, which Doctor performs but is not successful in saving his legs. Cal can never walk again. Also, doctor accidentally leaves a metal clamp inside Cal’s leg after sewing the leg up. This clamp causes great pain until it is discovered and removed. Cal comes to your law office to determine what his legal right are and who may be liable for his injuries.

law question

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
ORDER NOW

I Have A Proof Question Regarding Poisson Processes

I have a proof question regarding poisson processes. I know that you can prove that in a poisson process, the interarrival times follow an exponential distribution, and you can prove that the arrival times are uniform. I am wondering how you would prove this to be true for the discrete case, if the interarrival times are geometric, prove that the arrival times are discrete uniform, i.e. a discrete poisson process. Thanks!

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
ORDER NOW

I Have A Question About Sql Script Command

I have a question about SQL script command.

In order to list all publisher IDs that have published books (only included publishers that HAVE published a book) and each publisher ID should be displayed only once,

what command should I use?

Also the column header should be “Publisher ID”

I think I need to use ‘unique’ command.

Please help!

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
ORDER NOW

I Have A Question About The Continuous Time Fourier Transformation Using Matlab

I  have a question about the Continuous-time Fourier Transformation using Matlab. Could you help em out with it?

load splat;y=y(1:8192);N=8192;fs=8192;sound(y,fs);Y=fftshift(fft(y));%%part aw=[-pi:2*pi/N:pi-pi/N]*fs;plot(w,abs(Y));y=ifft(fftshift(Y));y=real(y);%%part bY1=conj(Y);…

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
ORDER NOW