Name: Sandipsinh Rathod
Email: sdr5549@psu.edu
Due Date: 11/10/24 11:59 PM
Class: CMPSC 330
Dots and Boxes:
Task:
This program will simulate the game of Dots and Boxes.
The game is played on a grid of dots. The players take turns connecting two horizontally or vertically adjacent dots.
If a player completes the fourth side of a 1x1 box, they get a point.
The game ends when we get an input "END".
The player(s) with the most points wins/ties.
Command used to compile:
g++ -ansi -pedantic -Wall dotsandboxes.cxx -o dotsandboxes && ./dotsandboxes hw2.txt
Note:
1. Although we are not allowed to use STL, I talked to the professor and he allowed me to use it for throwing errors.
2. As we needed to use recursion, I talked to Dr. Na and he said that my recursive function `reverseString` is fine.
Logic:
1. First, we will take the input from the file and serialize it.
2. Then we will iterate over the moves array and check if the element creates box(es).
3. If box(es) is/are completed, we will increment the score of the player.
4. Finally, we will print the score of the players.