Question: Dots and Boxes ( 1 0 0 points ) Write a program that finds the winner of the dots and boxes game. Your program should
Dots and Boxes points
Write a program that finds the winner of the dots and boxes game. Your program should do:
Read the game log file name from the command line argument;
Read the game log from the file that is composed of;
size of dots
player name, line coordinate
player name, line coordinate
END
Construct the board having dots using dynamic memory allocation;
Assign lines from the input, and determine box owners;
When the input is "END", step adding lines and determining box owners;
Print the number of boxes of a player sorted in lexicographical order and determine the winner.
The following command must be able to compile your program in SUN lab assuming the file name dotsandboxes.cxx:
$ gansi pedantic stdcWall dotsandboxes.cxx o dotsandboxes
If you run your program using the following command
$dotsandboxes gametxt
then the following output should be printed:
rr
bBbBb
br
bBbRr
rb
Player A has box.
Player B has boxes win
Regarding the game:
More than two players can participate in the game.
If a player puts a line in a dot location or a line that is already put, the game will be finished immediately, making
the player lose the game. In this case, when printing the board, show the wrong place with mark as follows
There will be no player:
rr
bBbBb
Xbr
bRr
rb
Player A has box win
Player B has boxes
Sample gametxt:
B
R
B
R
B
R
B
R
B
B
B
END
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
