Solved-Homework # 6- Solution

$30.00 $19.00

In this homework, you will re-write your game of reversi (HW4 and HW5) program in C++ using dynamic memory operations. You will have your Cell class as in HW4. For the Reversi class, you will hold Cell * gameCells; as a data member. All your board operations will be on this dynamic array. The class…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

In this homework, you will re-write your game of reversi (HW4 and HW5) program in C++ using dynamic memory operations.

You will have your Cell class as in HW4. For the Reversi class, you will hold Cell * gameCells;

as a data member. All your board operations will be on this dynamic array.

The class Reversi will also have the following features and functions

  • There is no limit for the board. Your game will resize according to the parameter for the constructor.

  • There should be at least 3 contructors.

  • The class will have functions to return the current width and height of the board

  • The class will have functions to resize the board. When the board is resized, the game starts from the beginning.

  • The class will have a function that displays the current board on the screen

  • The class will have two functions named play that plays the game for a single time step. First function does not take a paremeter and it plays the computer. The second function takes a cell position and it plays the user.

  • The class should have a function that returns if the game ended.

  • The class should have a function named playGame. This function plays the game by asking the user the board size first then asks the user to play and the computer plays, etc.

  • The class will have a static function that returns the number of living Reversi games.

  • The class will have a function that takes another object Reversi as parameter and compares the reversi games. It returns true is the first game is better for the user, otherwise it returns false.

  • Operator++ (both posfix and prefix) will advance the game by one step for computer. It will return the expected results.

  • Stream insertion operator that prints the game on the screen

  • Any other functions (public or private) needed.

Use your name space. Use separation of interface and implementation.

Write your main function to test both classes. Especially test assignment operators, copy constructor.

Send Reversi objects to functions using call by reference and call by value.