Go to file
Sandipsinh Rathod aad83f47dc
fix errors
2024-11-18 17:04:23 -05:00
CMakeLists.txt add readme and rename main.cpp 2024-10-11 19:36:01 -04:00
dotsandboxes.cxx fix errors 2024-11-18 17:04:23 -05:00
hw2.txt init 2024-10-09 19:39:24 -04:00
README.txt fix cmd in readme 2024-10-11 19:43:46 -04:00

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.