Question: **EDIT** THIS IS A C++ CODE This is a simulation of an Old West Saloon. You will create several classes which show how the various

**EDIT** THIS IS A C++ CODE

This is a simulation of an Old West Saloon. You will create several classes which show how the various players interact.

A Person class holds the name of a person/character. It has a Play()method which causes the class to execute all the actions re- quired of it every turn. It also has a Drink() method which causes the bartender to pour a drink and the class will drink it. This method has a 10% chance of getting called every turn. Person() is not supposed to be instantiated.

A PokerPlayer class derives virtually from the Person class. The Play() method plays poker by returning a random number in the range 1 .. 52, representing a card value. The highest card value wins.

A Gunslinger class is a child class. It has a Draw() method that returns a type double value representing a gunslingers draw time (from 1 to 10). The class also has an int member representing the number of notches on the gunslingers gun.

A CardSharp() class is also a child class. It has a Draw() method that also returns a draw time, but it is an int ranging from 5 to

15. There is a Play() method which returns a random card, like PokerPlayer(), but part of the time (25%) it will cheat and use a card already used. The Gunslinger() class has a 50% chance of de- tecting this and shooting the CardSharp(). See the shooting behavior below. Each drink increases the chance of cheating by +5%.

Finally, we have a Bartender() class. The Draw() method for this class will cause it to pour a beer.

Create a saloon where 4 random players are playing poker. If two players shoot each other, the one with the lowest number returned from Draw()wins. Shot players are always killed and replaced with a random player. Every turn display what the various characters are doing while they play poker. The game ends when all the cards are played and the player who has won the most hands is the winner.

Constraints.

Include methods for setting object values.

Overload the insertion operator () to show class details.

Randomly select a name for each character.

Make sure you have 1 of each class playing to start.

Iterate through a dynamic memory structure of classes and callplay()to

execute each players actions every turn.

Define a Card class with a suit and face value members and use a Card return value for Draw().

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!