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

Download:
Games-TicTacToe-0.05.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.05   Source   Latest Release: Games-TicTacToe-0.06

NAME ^

Games::TicTacToe - Interface to the TicTacToe game.

VERSION ^

Version 0.05

DESCRIPTION ^

A console based TicTacToe game to play against the computer.A simple TicTacToe player supplied with the distribution in the script sub folder.

METHODS ^

getGameBoard()

Returns game board for TicTacToe (3x3) as of now.

    use strict; use warnings;
    use Games::TicTacToe;
    
    my $tictactoe = Games::TicTacToe->new();
    print $tictactoe->getGameBoard();

addPlayer()

Add player to the TicTacToe game.It prompts the user to pick the player from Human / Computer. As soon as the user picks one, it then asks to pick the symbol for the selected user from X/O. Once the player and symbol are selected then it automatically selects the other player/symbol.

    use strict; use warnings;
    use Games::TicTacToe;
    
    my $tictactoe = Games::TicTacToe->new();
    $tictactoe->addPlayer();

getPlayers()

Returns the players information with their symbol.

    use strict; use warnings;
    use Games::TicTacToe;
    
    my $tictactoe = Games::TicTacToe->new();
    $tictactoe->addPlayer();
    print $tictactoe->getPlayers();

play()

Actually starts the game by prompty player to make a move.

    use strict; use warnings;
    use Games::TicTacToe;
    
    my $tictactoe = Games::TicTacToe->new();
    $tictactoe->addPlayer();
    $tictactoe->play();

isGameOver()

Returns 1 or 0 depending whether the TicTacToe is over or not. It dumps the winner name if any found. It also dumps the message if the games is drawn just in case.

    use strict; use warnings;
    use Games::TicTacToe;
    
    my $tictactoe = Games::TicTacToe->new();
    $tictactoe->addPlayer();
    $tictactoe->play();
    print "Thank you!!!\n" if $tictactoe->isGameOver();

AUTHOR ^

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

BUGS ^

Please report any bugs or feature requests to bug-games-tictactoe at rt.cpan.org or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Games-TicTacToe. I will be notified & 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::TicTacToe

You can also look for information at:

LICENSE AND COPYRIGHT ^

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: