

my $ttt = AI::Evolve::Befunge::Physics->new('ttt');

This is an implementation of the "ttt" game ruleset. It is implemented as a plugin for the AI::Evolve::Befunge Physics system; essentially an AI creature exists in a "tic tac toe" universe, and plays by its rules.

Use AI::Evolve::Befunge::Physics->new() to get a ttt object; there is no constructor in this module for you to call directly.

$ttt->setup_board($board);
Initialize the board to its default state. For tic tac toe, this looks like:
...
...
...
my $valid = $ttt->valid_move($board, $player, $pos);
Returns 1 if the move is valid, 0 otherwise. In tic tac toe, all places on the board are valid unless the spot is already taken with an existing piece.
my $winner = $ttt->won($board);
If the game has been won, returns the player who won. Returns 0 otherwise.
my $over = $ttt->over($board);
Returns 1 if no more moves are valid from either player, and returns 0 otherwise.
my $score = $ttt->score($board, $player, $number_of_moves);
Return a relative score of how the player performed in a game. Higher numbers are better.
my $can_pass = $ttt->can_pass($board, $player);
Always returns 0; tic tac toe rules do not allow passes under any circumstances.
$next_player = $ttt->make_move($board, $player, $pos)
if $ttt->valid_move($board, $player, $pos);
Makes the given move, updates the board with the newly placed piece.