Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    Games::Cards 1.45

    Download button

    No screenshots available
    Downloads: 577  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Amir Karger | More programs
    Perl Artistic License / FREE
    January 3rd, 2007, 22:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    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[1]->give_a_card ($Discard, "8D"); # discard 8 of diamonds

    This 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.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    writing card games | playing card games | Perl module | Games::Cards | writing | playing

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM