diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-06-02 21:27:24 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-06-02 21:27:24 -0500 |
commit | 666d5f780c2e43c81da331d51e69bb9f7d83288c (patch) | |
tree | bccd01e6f2cb17da84353608f98a2efa64ec41b1 | |
parent | 06d773397d06f8aafd1929d41fcca070e527f2aa (diff) | |
download | bot-games-666d5f780c2e43c81da331d51e69bb9f7d83288c.tar.gz bot-games-666d5f780c2e43c81da331d51e69bb9f7d83288c.zip |
better state command
-rw-r--r-- | lib/Bot/Games/Game/Chess.pm | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Bot/Games/Game/Chess.pm b/lib/Bot/Games/Game/Chess.pm index 1739b9d..554fe9e 100644 --- a/lib/Bot/Games/Game/Chess.pm +++ b/lib/Bot/Games/Game/Chess.pm @@ -68,9 +68,15 @@ command resign => sub { command state => sub { my $self = shift; my ($dummy, $args) = @_; - return $self->current_player - . ($self->game->to_move ? ' (white)' : ' (black)') - . ' to play: ' + my $player; + if ($self->num_players == 2) { + $player = $self->current_player; + $player .= $self->game->to_move ? ' (white)' : ' (black)'; + } + else { + $player = $self->game->to_move ? 'White' : 'Black'; + } + return "$player to play: " . App::Nopaste::nopaste(text => $self->game->dump_pos, nick => $args->{player}); }; |