Games::Euchre::AI

Games::Euchre::AI is a Player API for Euchre card game.
Download

Games::Euchre::AI Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Chris Dolan
  • Publisher web site:
  • http://search.cpan.org/~cdolan/

Games::Euchre::AI Tags


Games::Euchre::AI Description

Games::Euchre::AI is a Player API for Euchre card game. Games::Euchre::AI is a Player API for Euchre card game.This class implements a skeletal Euchre player programming interface. Subclasses can be created quite easily as interactive interfaces or AI computer players.If you wish to write your own computer player, I recommend you start with Games::Euchre::AI::Simple. If you wish to write your own human interface, I recommend you start with Games::Euchre::AI::Human.CLASS METHODSnewCreate and initialize a new Euchre AI. This object is implemented as an empty hash. Subclasses may wish to use this hash for state storage.INSTANCE METHODSActionsThe following methods are called in the course of the game where the AI (or human) has to make a decision. The state of the game is always passed in a hashreference. The following fields are always available:'name' is the name of the current player. This is useful for output messages.'names' is a hash relating player number to player name for all four players.'debug' is a boolean indicating if we are debugging game or the AIs. Your AI may wish to provide verbose output if debugging is going on.bid STATEHASHChoose trump or pass. The relevent details of the current state of the game are provided in a hash reference. Here is an example of that data structure: { name => 'Player 1', names => {1 => 'Player 1', 2 => 'P2', 3 => 'P3', 4 => 'Fred'}, number => 1, turnedUp => 'KH', passes => 1, ourScore => 2, theirScore => 4, winScore => 10, hangdealer => false, notrump => false, hand => , debug => false, }'turnedUp' is the suit and value of the card on the top of the blind. This will be undef on the second round of bidding.'passes' says how many people have passed so far'hangdealer' is a boolean saying whether the 'hang-the-dealer' optional rule is in effect'notrump' is a boolean saying whether the 'no trump' optional rule is in effectThis function must return one of: H, D, C, S, N, HA, DA, CA, SA, NA, or undef'N' means 'no trump', 'A' means 'alone', undef means 'pass'. Not all of these are legal at any given round! Use the isLegalBid() method below if you are unsure.pickItUp STATEHASHIf this is called, you are the dealer and someone called trump. Choose which card from your hand to discard in exchange for the top card of the blind. The relevent details of the current state of the game are provided in a hash reference. Here is an example of that data structure: { name => 'Player 1', names => {1 => 'Player 1', 2 => 'P2', 3 => 'P3', 4 => 'Fred'}, number => 1, turnedUp => 'KH', trump => 'H', bidder => 2, weBid => false, usAlone => false, themAlone => false, hand => , debug => false, }This method should return the 0-based index of the card to trade for the turnedUp card. Namely, this in the index of the 'hand' array for the card that you choose.playCard STATEHASHChoose which card from your hand to play on this trick. The relevent details of the current state of the game are provided in a hash reference. Here is an example of that data structure: { name => 'Player 1', names => {1 => 'Player 1', 2 => 'P2', 3 => 'P3', 4 => 'Fred'}, number => 1, trump => 'H', bidder => 2, weBid => true, usAlone => false, themAlone => false, trick => 2, ourTricks => 0, theirTricks => 1, ourScore => 2, theirScore => 4, winScore => 10, played => , playedBy => , hand => , debug => false, }'playedBy' is an arrayref of numbers of the players in the order they will play. Without this, the alone possibility makes it hard to tell who played what.Any needed information not stored here (like who was the dealer, what was the turn-up card, what happened in the first trick) is YOUR responsibility to collect and store in your instance.This method should return the 0-based index of the card to play. Namely, this in the index of the 'hand' array for the card that you choose. Requirements: · Perl


Games::Euchre::AI Related Software