Class ElevensBoard
java.lang.Object
Board
ElevensBoard
public class ElevensBoard extends Board
The ElevensBoard class represents the board in a game of Elevens.
-
Constructor Summary
Constructors Constructor Description ElevensBoard()
Creates a newElevensBoard
instance. -
Method Summary
Modifier and Type Method Description boolean
anotherPlayIsPossible()
Determine if there are any legal plays left on the board.boolean
isLegal(List<Integer> selectedCards)
Determines if the selected cards form a valid group for removal.
-
Constructor Details
-
ElevensBoard
public ElevensBoard()Creates a newElevensBoard
instance.
-
-
Method Details
-
isLegal
Determines if the selected cards form a valid group for removal. In Elevens, the legal groups are (1) a pair of non-face cards whose values add to 11, and (2) a group of three cards consisting of a jack, a queen, and a king in some order.- Parameters:
selectedCards
- the list of the indices of the selected cards.- Returns:
- true if the selected cards form a valid group for removal; false otherwise.
-
anotherPlayIsPossible
public boolean anotherPlayIsPossible()Determine if there are any legal plays left on the board. In Elevens, there is a legal play if the board contains (1) a pair of non-face cards whose values add to 11, or (2) a group of three cards consisting of a jack, a queen, and a king in some order.- Returns:
- true if there is a legal play left on the board; false otherwise.
-