Games::Euchre::Trick - Trick class for Euchre card game
Only one Trick instance is alive at one time per Euchre game. The Trick keeps track of which cards have been played, and provides useful functions to determine which cards are legal plays, as well as who is the winner of the trick. The trick class makes the determination of which card beats which card, given the current trump and lead. The trick class knows how to handle an alone hand and it calls the playCard() method for each player in turn in it's play() method, usually called from the Games::Euchre->playHand() method.
Create and initialize a new Euchre trick. The lead is a Games::Euchre::Player instance. The name is any string. The number is a one-based index of which trick this is (from 1 to 5).
Return the Euchre game instance to which this trick belongs.
Return the name of this trick.
Return the number of this trick (from 1 to 5).
Return the Games::Cards::Hand object representing this trick.
Return an array of the Games::Cards::Card objects played in this trick.
Return an array of the players in the order they will play in this trick. If someone went alone, this array will have three entries. Otherwise it will always have four.
Returns the 0-based index of the specified player in the order that he would play in the current trick. This is crucial for figuring out who played which card. Returns undef in the case that the player did not play (yet, or not at all if the partner went alone).
Record the result of this trick by informing the winning team.
Returns the player who played the card that won the trick.
Returns -1, 0, or 1 indicating the relative rank of the two cards. Like the string 'cmp' operator -1 means that CARD2 beats CARD1, 1 means that CARD1 beats CARD2 and 0 means that they are equivalent (i.e. both worthless!).
Calls the playCard() method for the player whose turn it is to play.
Returns a boolean indicating whether the selected card to play is legal, given the specified player's hand. CHOICE is a 0-based index into the array of cards held by the player's hand.
Checks if the choice is an actual card in the player's hand and whether the card follows suit.
GNU Public License, version 2
Chris Dolan, email@example.com