Chris Dolan > Games-Euchre > Games::Euchre::Player

Download:
Games-Euchre-1.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Games::Euchre::Player - Player class for Euchre card game

DESCRIPTION ^

The four Player objects are used to interact with the humand and computer players, as well as to keep the state of the players hand, whether he bid and whether he went alone.

CLASS METHODS ^

new GAME NUMBER NAME

Create and initialize a new Euchre player. The number is 1-4.

INSTANCE METHODS ^

getGame

Return the Euchre game instance to which this player belongs.

setTeam TEAM

Record the Team instance that this player belongs to.

getTeam

Return the Team instance to which this player belongs.

setAI AI

Record the AI instance for this player.

getAI

Return the AI instance for this player.

setAlone

Indicate that this player has chosen to go alone in the current hand.

setBid

Indicate that this player has chosen to choose trump in the current hand.

wentAlone

Returns a boolean indicating whether this player chose to go alone on a bid.

isBidder

Returns a boolean indicating whether this player called the trump suit during bidding.

getName

Return this player's name

getNumber

Return this player's number, between 1 and 4

getHand

Return the Games::Cards::Hand object representing this player's current hand.

getCards

Return an array of the Games::Cards::Card objects held in the player's hand.

resetGame

Clear all of the state for the current game and get ready for the next one.

resetHand

Clear all of the state for the current hand and get ready for the next one.

bid TURN

Allow the player to choose trump or pass. Returns one of: H, C, D, S, N, HA, CA, DA, SA, NA, or undef. If the player has an AI instance set, that is invoked. Otherwise a pathetically simple AI decides the bid.

pickItUp

Allow the player, as dealer, to select which card to trade for the turned up card. This method performs the actual trade. If the player has an AI instance set, that is invoked. Otherwise a pathetically simple AI chooses the card.

playCard TRICK

Allow the player to select which card to play on the current trick. This method performs the actual play. If the player has an AI instance set, that is invoked. Otherwise a pathetically simple AI chooses the card.

isLegalBid TURNNUMBER BID

Given a bid, return a boolean indicating the validity of that bid. The bid is tested for structure (one of H, C, D, S, N, HA, CA, DA, SA, NA, or undef), tested against the bidding round (only the turned-up card suit can be called in round 1 , and may not be called in round 2), against the game options (hang-the-dealer, no-trump).

This is called from the bid() method.

SEE ALSO ^

Games::Euchre

LICENSE ^

GNU Public License, version 2

AUTHOR ^

Chris Dolan, chrisdolan@users.sourceforge.net

syntax highlighting: