The writer is very fast, professional and responded to the review request fast also. Thank you.
In this project, you will add a new game, called “Nim”, to your “games” program as one of the selection of games the User can play. The new game will use the usual conversation (prompt, listen ,respond and clean up) loop, and be written using OOP style.
Name the .cpp file “games.cpp”.
The Nim Game
The game is set up by selecting a number of rows (AKA heaps or piles), and for each row selecting a number of “pins” (or toothpicks or stones). Players alternate taking turns. On each turn, a player takes one or more (up to all) pins from a single row. The game ends when all the pins have been taken, no row has any pins. For further information, see
http://en.wikipedia.org/wiki/Nim#Game_play_and_illustration
Specification
Implement the game Nim, as a class in its own Nim.h header file. Use the Ifndef Wrapper Trick. Add the Nim game to the games master menu. The games master object will instantiate a Nim game
object and call its conversation() method. Once the game has been won/lost, the Nim game object’s conversation() method will return. The games master will then ask the User to select another game, as usual. Again, the main .cpp file should be “games.cpp”. As you are adding one new game to the two existing games, make sure that they still work.
Setup
Setup each new game of Nim, by randomly select a number of rows between 3 and 5. And for each row randomly select a number of pins bewteen 3 and 8. Use an array with one slot for each row. In each array slot (which represents a row) place the number of pins for that row.
Thus, if you have 4 rows, the array will have 4 slots. If a row has 8 pins in it, then it’s array slot will have the value 8.
Game State Display
Each row has a numeric name starting with A. Thus, if a game has an eighth row, its name is 7. On each row, following a colon, ‘:’, show the pins as a list of characters (e.g., strokes ‘|’). Here is a sample game state:
0: |||
1: ||
2: ||||||
On each User turn, display the current game state before prompting the User for a move. On each A.I. Brain turn, display the current game state before showing the Brain’s move.
Moves
Each move consists of a row number and then the number of pins to remove. Input these two numbers with a single CIN statement. If the User chooses an empty row, remind the User that at least one pin must be taken and prompt the User again. If the User chooses fewer than 1 pin, assume the User meant to take 1 pin and do so. If the User chooses more than all the pins for the row, assume the
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more