2023 The Nim Game In this project you will add a new game called Nim to | Assignment Collections

Computer Science 2023 Write A Program Using C++ For NIM Game By Using Array

2023 The Nim Game In this project you will add a new game called Nim to | Assignment Collections

 

 

The Nim Game :

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 loop, and be written using OOP style.

Name the .cpp file “games.cpp”.
The projects are individual. Only work on your own project.

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

page1image27320

 

User meant to take all the pins and do so.


Your Nim game will have a level-zero A.I. Brain play against the User. This Brain (being level-

zero) will pick a non-empty row at random and then take a random number of pins from that row. How you arrange for this is up to you.
Move Display

When each move (the User’s or the Brain’s) is determined, display that move like the following example moves:

     "You take 7 pins from row 1"
     "I take 2 pins from row 0"

Winning

After each move (the User’s and the Brain’s), check whether all the pins have been taken away. If so, declare the winner (and exit the game, returning control back to the games master). 

 

We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.

Place Order Now

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational