Question
Prog 2: Cuatro (USING C++) Under Construction Write a program to play the game of Cuatro, an invented close cousin of Tic-Tac-Toe and Quarto. This
Prog 2: Cuatro (USING C++)
Under Construction Write a program to play the game of Cuatro, an invented close cousin of Tic-Tac-Toe and Quarto. This is a two-player game unlike Tic-Tac-Toe in that you don't have "your" pieces and "their" pieces, but rather the winner is the one who on their move is first to complete a configuration of 4 pieces of the same type, drawing upon all the pieces remaining to play. Once placed on the board pieces cannot be moved. Running the game looks like the following:Welcome to the game of Cuatro, where you try to complete a set of four pieces that are alike. Players take turns making moves. On each move your OPPONENT chooses the piece, then YOU get to place it on the board. If you create a set of four alike when you place your piece, then you win! A set of four alike can be completed by using four all upper (or all lower) case characters, four all vowels (or all consonants), or four all curved (or all straight-lined). Curved letters are 'O' and 'C' (upper or lower), and straight-line letters are 'I' and 'Z' (upper or lower). Groups of four can be created in a row, column, diagonal, or corner quadrant. When prompted for input you may also enter 'x' or 'X' to exit. --------- Square # | . . . . | 1 2 3 4 | . . . . | 5 6 7 8 | . . . . | 9 10 11 12 | . . . . | 13 14 15 16 --------- Pieces: Curved Straight Upper: OO/CC II/ZZ Lower: oo/cc ii/zz Vowel/Consonant 1. Player 1 enter piece, and Player 2 enter destination: C 6 --------- Square # | . . . . | 1 2 3 4 | . C . . | 5 6 7 8 | . . . . | 9 10 11 12 | . . . . | 13 14 15 16 --------- Pieces: Curved Straight Upper: OO/ C II/ZZ Lower: oo/cc ii/zz Vowel/Consonant 2. Player 2 enter piece, and Player 1 enter destination: O1 --------- Square # | O . . . | 1 2 3 4 | . C . . | 5 6 7 8 | . . . . | 9 10 11 12 | . . . . | 13 14 15 16 --------- Pieces: Curved Straight Upper: O/ C II/ZZ Lower: oo/cc ii/zz Vowel/Consonant 2. Player 2 enter piece, and Player 1 enter destination: O1 --------- Square # | O . . . | 1 2 3 4 | . C . . | 5 6 7 8 | . . . . | 9 10 11 12 | . . . . | 13 14 15 16 --------- Pieces: Curved Straight Upper: O/ C II/ZZ Lower: oo/cc ii/zz Vowel/Consonant 3. Player 2 enter piece, and Player 1 enter destination: D2 *** Sorry, that is an invalid piece. Please retry. 3. Player 2 enter piece, and Player 1 enter destination: z1 *** Sorry, that destination is occupied. Please retry. 3. Player 2 enter piece, and Player 1 enter destination: z 17 *** Sorry, that destination is invalid. Please retry. 3. Player 2 enter piece, and Player 1 enter destination: z 8 --------- Square # | O . . . | 1 2 3 4 | . C . z | 5 6 7 8 | . . . . | 9 10 11 12 | . . . . | 13 14 15 16 --------- Pieces: Curved Straight Upper: O/ C II/ZZ Lower: oo/cc ii/z Vowel/Consonant 4. Player 2 enter piece, and Player 1 enter destination: ... Notes: Here are examples of winning sets of four, which could be found in any row, column, diagonal, or corner quadrant of four adjacent squares:
After selecting a piece and placing it on the board, the program should no longer display that piece as an option to be selected to be played. On each move the program should do error-checking to ensure that only available pieces can be selected to be played, and that the destination square is not already occupied. After each move the program should also check to see if there was a win for the player that just placed a piece. Stages
|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started