Question: Game Development: Uno For this assignment you will be creating the game of Uno (See the accompanying pdf for the instructions of the game). Your
Game Development: Uno For this assignment you will be creating the game of Uno (See the accompanying pdf for the instructions of the game). Your version will adhere to all the rules except that only the next player can issue a challenge against the previous player in regards to penalties, and your games must have at least three (3) players and at most nine (9) players. To begin, you must create the class Card which contains:
Private string field named symbol.
Private string field named type.
Public default constructor that assigns the empty string to both fields.
Public overloaded constructor that takes two (2) const string references named symbol and type respectively as parameters.
It should assign symbol to the symbol field and type to the type field.
Public copy constructor that performs a shallow copy.
Public get accessor methods for both fields.
Public set accessor methods for both fields.
Public string method named ToString() that takes no parameters.
It should return the symbol field followed by the type field separated by a colon and all enclosed in square braces.
Afterwards, create the interface CardComparer which contains: int method named TypeCompare() that takes a Card refence as a parameter. int method named SymbolCompare() that takes a Card reference as a parameter.
int method named CardCompare() that takes a Card reference as a parameter.
Next, create the abstract class ComparableCard which inherits: Card publicly.
CardComparer publicly. and contains: Public default constructor that assigns the empty strings to the fields symbol and type.
Public overloaded constructor that takes two (2) const strings references named symbol and type respectively as parameters.
It should assign symbol to the symbol field and type to the type field. And create the class Deck which contains:
Private dynamic ComparableCard pointer array field named list.
Private int field named capacity.
Private int field named size.
Private void method named Resize() that takes no parameters. It increases capacity by ten (10), reallocates list to the size of the new value of capacity while maintaining the values of list.
Public default constructor that assigns sixty (60) to capacity, allocates list to capacity and assigns zero (0) to size.
Public overloaded constructor that takes one (1) int named capacity as a parameter. It should assign capacity to the capacity field only if capacity is greater than zero (0); otherwise, it assigns sixty (60) to the capacity field. Afterwards, it allocates list to the capacity field and assigns zero (0) to size.
Public overloaded assignment operator that performs a deep copy. Make sure not to rewrite list whenever there is a self assignment.
Public bool method named IsEmpty() that takes no parameters. It returns true if size equals zero (0); otherwise, it returns false.
Public get accessor method for size.
Public void method named AddCard() that takes a ComparableCard pointer named card and an int named index as parameters. If index is between zero (0) and size inclusively, it should add card to list at index and increment size by one (1). You must call Resize() whenever size is equal to capacity before you add card to list.
Public ComparableCard pointer method named RemoveCard() that takes an int named index as a parameter. If index is less than zero (0) or greater than or equal to size, it should return NULL; otherwise, it should remove the element of list with an index of index, adjusts the elements of list if necessary, decrement size by one (1), and return the removed element.
Public ComparableCard pointer method named ShowCard() that takes an int named index as a parameter. If index is less than zero (0) or greater than or equal to size, it should return NULL; otherwise, it should return the element of list at the index of index.
Public void method named Shuffle() that takes no parameters. It should shuffle the elements of list.
Public void method named Sort() that takes no parameters. It should sort the elements of list in ascending order.
Public string method named ToString() that takes no parameters. It shoud return a string listing all the elements of list in an line. If list is empty, it should return an empty string.
Then create the class UNOCard which inherits: ComparableCard publicly. and contains:
Private int field named action.
Private int field named value.
Public static const strings for each UNO color named BLACK, RED, GREEN, BLUE, and YELLOW. You can assign them whatever values you desire.
Public static const strings for each UNO symbol named ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, DRAWTWO, REVERSE, SKIP, WILD, and WILDFOUR. You can assign them whatever values you desire.
Private int method named SymbolRank() that takes a const string reference named value as a parameter. If value equals a valid Uno symbols, it returns a non-negative integer value you desire for the particular symbol; otherwise, it returns 1.
Private int method named ColorRank() that takes a const string reference named value as a parameter. If value equals a valid Uno colors, it returns a non-negative integer value you desire for the particular color; otherwise, it returns 1.
Private void method named SetCard() that takes two (2) const string references named symbol and color respectively as parameters. If symbol and color represents a valid Uno card, it assigns the appropriate values to the symbol, type (representing color), action, and value fields.
Use the following table to identify valid Uno cards and their corresponding action and value values Symbol Colors Action Value 0 Red, Green, Blue, Yellow 0 0 1 Red, Green, Blue, Yellow 0 1 2 Red, Green, Blue, Yellow 0 2 3 Red, Green, Blue, Yellow 0 3 4 Red, Green, Blue, Yellow 0 4 5 Red, Green, Blue, Yellow 0 5 6 Red, Green, Blue, Yellow 0 6 7 Red, Green, Blue, Yellow 0 7 8 Red, Green, Blue, Yellow 0 8 9 Red, Green, Blue, Yellow 0 9 Draw Two Red, Green, Blue, Yellow 1 20 Reverse Red, Green, Blue, Yellow 2 20 Skip Red, Green, Blue, Yellow 3 20 Wild Black 4 20 Wild Draw Four Black 5 20 where the action values are associated as follows Action Value Nothing 0 Draw Two 1 Reverse 2 Skip 3 Wild 4 Wild Draw Four 5 . Otherwise, it sets the card to the Wild card.
Public default constructor that calls SetCard() with arguments WILD and BLACK.
Public overloaded constructor that takes two (2) const string references named symbol and color respectively as parameters. It calls SetCard() with arguments symbol and type to the color.
Public get accessor methods for action and value.
Public definitions of the methods of the interface CardComparer. Use ColorRank() and SymbolRank() to simplify definitions. Furthermore, cards compare their symbols first then their type. Last create the class UNOGameBuilder
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
