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 (100 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):
$ g++-ansi -pedantic -std=c++14-Wall dotsandboxes.cxx -o dotsandboxes
If you run your program using the following command
$./dotsandboxes game1.txt
then the following output should be printed:
0
1
012345678901234
00.r.r......
1 bBbBb
2.b.r......
3 bBbRr
4.r.b......
Player A has 1 box.
Player B has 3 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 'x' mark as follows
(There will be no x player):
0
1
012345678901234
00
.r.r......
1 bBbBb
2 Xb.r.....
3 bRr
4.r.b.....
Player A has 1 box (win)
Player B has 2 boxes
Sample game1.txt:
38
B 10
R 01
B 32
R 41
B 14
R 23
B 43
R 34
R,0,3
B 12.
B 21
B 30
END
Dots and Boxes ( 1 0 0 points ) Write a program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!