Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pile C Pile A Player 1 takes 2 from Pile A 2 takes 3 from Ple C Pluyer 1 takes 1 from Ple& uyer 2

image text in transcribed
image text in transcribed
Pile C Pile A Player 1 takes 2 from Pile A 2 takes 3 from Ple C Pluyer 1 takes 1 from Ple& uyer 2 takes 1 from PleB I takes the entire Pile A Player 2 takes 1 from Pile Player 1 takes 1 from Pile C takes 1 from Ple B I o Inner 1 must take 1 from P le cand lose o o Tablk 1. Exampk Nim Gameplay The following classes must be implemented as part of your overall implementation. These class descriptions provide a high-level specification of the necessary components of your game. The 3.1 Required Classes class descriptions below provide the required elements, but your classes may need other members in order to fully implement the game. Other than the required classes and functions, you will need to decide on the low-level implementation details such as your class constructors the representation of your piles of stones, how a user specifies actions in the game, etc. 1. Game o The Game class is responsible for representing the game state (i.e. the piles, the status of the piles, the current turn, etc.). We should be able to play a game with any combination of 2 players, human or AL Examples: Human vs. human, human vs. Al, or Al vs. Al The Game class must contain the following members. o o * piles . . A data structure containing the piles of stones. The user should be able to specify the number of piles and the size of the piles at the beginning of the game. * play0 The main game loop. This should cause the players to take turns and print an updated game state each turn (see the step) function below). The main game loop should continue until the game ends with one player winning The winner should be announced at the end of the game. . . step) : Causes both players to make a move, and then updates the screen " displayO Prints the current game state to the standard input. savet Optional-for 5 total bonus points, with loado) Save the current game state to a file, so that the game can be resumed later Noeds to record the state of the piles (how many there are, and how many a. stones are left in each pile)

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

Students also viewed these Databases questions