Question
This assignment focuses on C++ classes and two-dimensional arrays. The company, Silly Little Games , has decided to expand its repertoire and include the game
This assignment focuses on C++ classes and two-dimensional arrays.
The company, Silly Little Games, has decided to expand its repertoire and include the game Tic-Tac-Toe. The game is for two players. One player places the X pieces and the other player places the O pieces. The basic game board is a grid of 9 spaces, in a 3 x 3 arrangement (although your game should be flexible enough to handle a 5 x 5, 7 x 7 or any other size in the future). When one player covers an entire row, column or diagonal, that player wins the game.
In C++, using a class, a multidimensional dynamic array and appropriate-designed methods and functions, write a program that will:
- Allow two users to play Tic-Tac-Toe as many times as desired
- Display the board
- Allow users to place pieces (X or O) by taking turns
- Check for a winner
- Keep a running scoreboard and print it after each game.
Notes:
- The board, with the actions that can be taken on it, will be in a class.
- Clear the screen (25 blank lines is sufficient) before explaining your program to the user. There is no need to clear the screen between your explanation and the beginning of the game. A few blank lines will be sufficient.
- The board should be displayed after each turn. Empty (available) spaces should appear blank. Used spaces should have the appropriate character in them.
- Users should indicate where to place their pieces by using a numbering or lettering system for each row and column. Make sure you label the display to help the user.
- The user may place pieces only in empty spaces check before you place the piece.
- Remember that no player may place two pieces in a row you may choose to require X or O to start or you may leave the choice to the users, but you must enforce the alternating turns.
- The game ends as soon as one player has filled one row or one column or one full diagonal.
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