Mohammad S Anwar > Games-Domino-0.05 > Games::Domino

Download:
Games-Domino-0.05.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.05   Source  

NAME ^

Games::Domino - Interface to the Domino game.

VERSION ^

Version 0.05

DESCRIPTION ^

This is a very basic Domino game played by two players (Computer vs Human) at the moment.This is just an initial draft of Proof of Concept, also to get my head around the game which I have never played in my life before. There is a cheat flag which makes tiles for "Computer" visible to the other player "Human". Avoid this flag if possible. By default the cheat flag is turned off.There is a debug switch as well which is turned off by default.They are arranged like here before we shuffle to start the the game.

    [0 | 0]
    [0 | 1] [1 | 1]
    [0 | 2] [1 | 2] [2 | 2]
    [0 | 3] [1 | 3] [2 | 3] [3 | 3]
    [0 | 4] [1 | 4] [2 | 4] [3 | 4] [4 | 4]
    [0 | 5] [1 | 5] [2 | 5] [3 | 5] [4 | 5] [5 | 5]
    [0 | 6] [1 | 6] [2 | 6] [3 | 6] [4 | 6] [5 | 6] [6 | 6]

    use strict; use warnings;
    use Games::Domino;

    my $domino = Games::Domino->new();

METHODS ^

play()

Pick a tile from the current player. If no matching tile found then picks it from the stock until it found one or the stock has only 2 tiles left at that time the game is over.

    use strict; use warnings;
    use Games::Domino;

    my $domino = Games::Domino->new();
    $domino->play;

is_over()

Returns 1 or 0 depending whether the game is over or not. The game can be declared over in the following circumstances:

    use strict; use warnings;
    use Games::Domino;

    my $domino = Games::Domino->new();
    do { $domino->play; } until $domino->is_over;

result()

Declares who is the winner against whom and by how much margin.

    use strict; use warnings;
    use Games::Domino;

    my $domino = Games::Domino->new();
    do { $domino->play; } until $domino->is_over;
    $domino->result;

show()

Print the current tiles of Computer, Human and matched one.

    use strict; use warnings;
    use Games::Domino;

    my $domino = Games::Domino->new();
    do { $domino->play; $domino->show; } until $domino->is_over;

as_string()

Returns all the unused tiles remained in the bank.

    use strict; use warnings;
    use Games::Domino;

    my $domino = Games::Domino->new();
    do { $domino->play; } until $domino->is_over;
    print "DOMINO : $domino\n\n";

AUTHOR ^

Mohammad S Anwar, <mohammad.anwar at yahoo.com>

BUGS ^

Please report any bugs or feature requests to bug-games-domino at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-Domino.I will be notified,and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc Games::Domino

You can also look for information at:

LICENSE AND COPYRIGHT ^

Copyright 2012 Mohammad S Anwar.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

DISCLAIMER ^

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

syntax highlighting: