Question
//c++ program Class designs must include single inheritance hierarchies Each class that manages dynamic memory must have (a) constructor, (b) destructor (C++), (c) copy constructors
//c++ program
Class designs must include single inheritance hierarchies
Each class that manages dynamic memory must have (a) constructor, (b) destructor (C++), (c) copy constructors (C++).
All data members must be private or protected (never public).
All arrays must be dynamically allocated with new
Global variables/objects are not allowed; global constants are fine
Implementation of the data structures requires full support of insert, removal, display, retrieval, and remove-all. If a balanced tree is selected, removal of an individual item is not expected to be implemented. In such cases please discuss alternatives with your instructor.
You are required to make your program simulate the game with players instead of asking user to enter input. It would take a long time to play a game if you allow user interaction which makes it hard to test and debug. The program should display game progress in an easy to read manner, such as showing players hand and current field information etc.
*********************************************************************************************
Assignment
focusing on how to create Object Oriented Solutions. An ADT may be part of that solution but it certainly shouldnt be the primary focus. Instead you want to strive for classes to have specific jobs and have classes derived from more general classes, whenever appropriate.
creating a text based simulation of the game chicken foot. It starts with a deck of cards in our case. The cards have different numbers on the two ends (simulating a domino). Each card is called a bone. Each player is dealt 7 bones and the bones remaining are left in the chicken yard. The player that has the largest double (where both numbers on a card are the same) place this bone in the field first. The players then rotate placing a bone that matches one of the numbers with a free side on the field. Any time a double is played, players attach up to 3 bones to the double (making for a chicken foot). In fact, when a double is played the ONLY bones that can be played are those that match the double otherwise the player has to draw once. A chicken foot must be filled with 3 bones before the game may proceed. The initial double however is played to all four sides. The player who uses all of their bones wins. There is a point system for the other players based on the bones left in each players hands. The goal is to get the fewest points possible.
To make this Object Oriented:
You will want to first think about breaking this down into a series of classes and create them independent of the entire game. Here are some suggestions to start with. You may alter this set of classes but not reduce the number of classes required.
- Bone class that creates a card that has two ends with values that range from 1-9
- Chicken yard class that manages the deck of cards that can be drawn from, including shuffling the deck
- Field class that manages what bones have free sides and when a chicken foot is being played requiring certain actions
- Game class that manages the interactions of the field, chicken yard, and players turns
- Player class that manages a players hand and score
Anything that is similar between these or other classes that you write should be pulled up to be part of a base class. For example, classes that manage collections of items may be derived from a common base class that manages the collection.
****************************************************************
YOUR GOAL:
will be to establish the bone, chicken yard and player classes. It is expected that bones will be shuffled, dealt, players can draw bones, and points managed for what bones the player holds during program #1. It is NOT expected that the player will physically play the game in program #1. Select the best data structure from for chicken yard and players hand for fast retrieval.
****************************************************************
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started