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 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 bottomthe 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 playCardremoves a Card from the top of the players hand position and returns it
public boolean slapsLinkedList 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
