|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.parlor.card.trick.util.TrickCardGameUtil
public class TrickCardGameUtil
Methods of general utility to trick-taking card games.
| Field Summary |
|---|
| Fields inherited from interface com.threerings.parlor.card.trick.data.TrickCardCodes |
|---|
BOTTOM, LEFT, RIGHT, TOP |
| Fields inherited from interface com.threerings.parlor.card.data.CardCodes |
|---|
ACE, BLACK_JOKER, CLUBS, DIAMONDS, HEARTS, JACK, KING, QUEEN, RED_JOKER, SPADES |
| Fields inherited from interface com.threerings.presents.data.InvocationCodes |
|---|
ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR |
| Constructor Summary | |
|---|---|
TrickCardGameUtil()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TrickCardGameUtil()
| Method Detail |
|---|
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 desired
public 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 none
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||