diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-06-02 21:16:02 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-06-02 21:16:02 -0500 |
commit | a5020cfdb1f6408654ff778a8d04cc39ac44f3ae (patch) | |
tree | ce8c5f46e1c36122e047bc30406c64b06bcc90b1 | |
parent | b0223acdfe64b78e65c8f1a801763ea7bc4f3197 (diff) | |
download | bot-games-a5020cfdb1f6408654ff778a8d04cc39ac44f3ae.tar.gz bot-games-a5020cfdb1f6408654ff778a8d04cc39ac44f3ae.zip |
add a command to check the current state of the game
-rw-r--r-- | lib/Bot/Games/Game/Chess.pm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Bot/Games/Game/Chess.pm b/lib/Bot/Games/Game/Chess.pm index 25f550e..2f0adef 100644 --- a/lib/Bot/Games/Game/Chess.pm +++ b/lib/Bot/Games/Game/Chess.pm @@ -65,6 +65,16 @@ command resign => sub { nick => $args->{player}) }; +command state => sub { + my $self = shift; + my ($dummy, $args) = @_; + return $self->current_player + . ($self->game->to_move ? ' (white)' : ' (black)') + . ' to play: ' + . App::Nopaste::nopaste(text => $self->game->dump_pos, + nick => $args->{player}); +}; + sub format_turn { my $self = shift; my ($turn) = @_; |