Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

3. Would you say that effective teamwork saved their lives?

Answered: 1 week ago