Question: Deck.Deck(Deck d) : creates a deck by making a deep copy of the input deck. Hint: use the method getCopy from the class Card. Disclaimer:

Deck.Deck(Deck d) : creates a deck by making a deep copy of the input deck. Hint: use the method getCopy from the class Card. Disclaimer: this is not the correct way of making a deep copy of objects that contain circular references, but it is a simple one and good enough for our purposes.

Deck is a doubly-linked list with cards(nodes).

public class Deck { public static String[] suitsInOrder = {"clubs", "diamonds", "hearts", "spades"}; public static Random gen = new Random(); public int numOfCards; // contains the total number of cards in the deck public Card head; // contains a pointer to the card on the top of the deck
public PlayingCard getCopy() { return new PlayingCard(this.suit, this.rank); }

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!