public class TrickCardGameUtil extends Object implements TrickCardCodes
BOTTOM, LEFT, RIGHT, TOP| Constructor and Description |
|---|
TrickCardGameUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
canFollowSuit(PlayerCard[] cardsPlayed,
Hand hand)
Checks whether the player can follow the suit lead with the hand given.
|
static boolean |
containsCard(PlayerCard[] cards,
Card card)
Checks whether the specified array contains the given card.
|
static int |
countSuitMembers(PlayerCard[] cards,
int suit)
Determines the number of cards that belong to the specified suit within the array given.
|
static boolean |
followsSuit(PlayerCard[] cardsPlayed,
Card card)
Checks whether the proposed card follows the suit lead.
|
static PlayerCard |
getHighestInLeadSuit(PlayerCard[] cardsPlayed,
int trumpSuit)
Returns the highest card (according to the standard A,K,...,2 ordering) in the suit lead,
with an optional trump suit.
|
static int |
getLeftIndex(int pidx)
For four-player games, returns the index of the player to the left of the specified player.
|
static int |
getNextInClockwiseSequence(int pidx)
For four-player games, this returns the index of the player after the specified player
going clockwise around the table.
|
static int |
getOppositeIndex(int pidx)
For four-player games, returns the index of the player across from the specified player.
|
static int |
getOtherTeamIndex(int tidx)
For four-player games with fixed partnerships, this returns the index of the other team.
|
static int |
getPartnerIndex(int pidx)
For four-player games with fixed partnerships, this returns the index of the player's
partner.
|
static int |
getRelativeLocation(int pidx1,
int pidx2)
For four-player games with fixed partnerships, this returns the relative location of one
player from the point of view of another.
|
static int |
getRightIndex(int pidx)
For four-player games, returns the index of the player to the right of the specified
player.
|
static int |
getTeamIndex(int pidx)
For four-player games with fixed partnerships, this returns the index of the player's team.
|
static int |
getTeamMemberIndex(int tidx,
int midx)
For four-player games with fixed partnerships, this returns the index of one of the members
of a team.
|
public static int getTeamIndex(int pidx)
pidx - the player indexpublic static int getOtherTeamIndex(int tidx)
tidx - the index of the teampublic static int getPartnerIndex(int pidx)
public static int getTeamMemberIndex(int tidx,
int midx)
tidx - the index of the teammidx - the index of the player within the teampublic static int getNextInClockwiseSequence(int pidx)
public static int getRelativeLocation(int pidx1,
int pidx2)
pidx1 - the index of the player to whom the location is relativepidx2 - the index of the player whose location is desiredpublic static int getLeftIndex(int pidx)
public static int getRightIndex(int pidx)
public static int getOppositeIndex(int pidx)
public static boolean canFollowSuit(PlayerCard[] cardsPlayed, Hand hand)
public static boolean containsCard(PlayerCard[] cards, Card card)
public static int countSuitMembers(PlayerCard[] cards, int suit)
public static boolean followsSuit(PlayerCard[] cardsPlayed, Card card)
public static PlayerCard getHighestInLeadSuit(PlayerCard[] cardsPlayed, int trumpSuit)
trumpSuit - the trump suit, or -1 for noneCopyright © 2015. All rights reserved.