Games::Cards

Games::Cards is a Perl module for writing and playing card games.
Download

Games::Cards Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Amir Karger
  • Publisher web site:
  • http://search.cpan.org/~akarger/Language-Zcode-0.8/lib/Language/Zcode.pm

Games::Cards Tags


Games::Cards Description

Games::Cards is a Perl module for writing and playing card games. Games::Cards is a Perl module for writing and playing card games.SYNOPSIS use Games::Cards; my $Rummy = new Games::Cards::Game; # Create the correct deck for a game of Rummy. my $Deck = new Games::Cards::Deck ($Rummy, "Deck"); # shuffle the deck and create the discard pile $Deck->shuffle; my $Discard = new Games::Cards::Queue "Discard Pile"; # Deal out the hands foreach my $i (1 .. 3) { my $hand = new Games::Cards::Hand "Player $i" ; $Deck->give_cards($hand, 7); $hand->sort_by_value; push @Hands, $hand; } # print hands (e.g. "Player 1: AS 2C 3C 3H 10D QS KH") foreach (@Hands) { print ($_->print("short"), "n") } $Hands->give_a_card ($Discard, "8D"); # discard 8 of diamondsThis module creates objects and methods to allow easier programming of card games in Perl. It allows you to do things like create decks of cards, have piles of cards, hands, and other sets of cards, turn cards face-up or face-down, and move cards from one set to another. Which is pretty much all you need for most card games. Requirements: · Perl


Games::Cards Related Software