![]() |
![]()
| ![]() |
![]()
NAMEGames::AlphaBeta - game-tree search with object oriented interface SYNOPSISpackage My::GamePos; use base qw(Games::AlphaBeta::Position); # initialise starting position sub _init { ... } # Methods required by Games::AlphaBeta sub apply { ... } sub endpos { ... } # optional sub evaluate { ... } sub findmoves { ... } # Draw a position in the game (optional) sub draw { ... } package main; my $pos = My::GamePos->new; my $game = Games::AlphaBeta->new($pos); while ($game->abmove) { print draw($game->peek_pos); } DESCRIPTIONGames::AlphaBeta provides a generic implementation of the AlphaBeta game-tree search algorithm (also known as MiniMax search with alpha beta pruning). This algorithm can be used to find the best move at a particular position in any two-player, zero-sum game with perfect information. Examples of such games include Chess, Othello, Connect4, Go, Tic-Tac-Toe and many, many other boardgames. Users must pass an object representing the initial state of the game as the first argument to new(). This object must provide the following methods: copy(), apply(), endpos(), evaluate() and findmoves(). This is explained more carefully in Games::AlphaBeta::Position which is a base class you can use to implement your position object. INHERITED METHODSThe following methods are inherited from Games::Sequential: METHODS
BUGSThe valid range of values evaluate() can return is hardcoded to -99_999 - +99_999 at the moment. Probably should provide methods to get/set these. TODOImplement the missing iterative deepening alphabeta routine. SEE ALSOThe author's website, describing this and other projects: <http://brautaset.org/projects/> AUTHORStig Brautaset, <stig@brautaset.org> COPYRIGHT AND LICENCECopyright (C) 2004 by Stig Brautaset This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.
|