Question: java player class for ERS card game A player consists of the following member variables: playerNum, an integer ( 1 , 2 , etc )

java player class for ERS card game
A player consists of the following member variables:
playerNum, an integer (1,2, etc) to identify which player it is
hand, a LinkedList of cards in their hand. The first element in the list is considered to be on top and new cards should be added to the bottom(the end of the list)
pattern, a String representing the type of pattern this player watches for, chosen at random from the Game classs patterns array
Additional member variables as you deem appropriate
Players consist of the following methods:
An overloaded constructor that takes a player number, a LinkedList of Cards representing their entire hand, and the pattern they should recognize
public Card playCard()**removes a Card from the top of the players hand (position 0) and returns it
public boolean slaps(LinkedList pile)- evaluates the Players pattern member variable and calls the appropriate Game static method to check for that pattern. If the pattern is in play, the method should return true to slap. If not, the method should return false.
Accessor methods for all member variables: getPlayerNum(), getHand(), getPattern() etc
toString that returns the Players number, pattern, and current hand of cards
Other private helper methods as required to implement game play rules

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 Programming Questions!