summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-22 15:46:03 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-22 15:46:03 -0400
commit7f1c579ea664fd007ca68f639a1ba22dd78052f8 (patch)
tree781a0544401983508843507b2d5dab924c26ffa8
parentfd19b85cf8d9c9af076c0165a218ef21e656fb2e (diff)
downloadBot-Zulip-Chess-7f1c579ea664fd007ca68f639a1ba22dd78052f8.tar.gz
Bot-Zulip-Chess-7f1c579ea664fd007ca68f639a1ba22dd78052f8.zip
handle the case of the first turn
-rw-r--r--lib/Bot/Zulip/Chess.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Bot/Zulip/Chess.pm b/lib/Bot/Zulip/Chess.pm
index 3f3e97b..13d563d 100644
--- a/lib/Bot/Zulip/Chess.pm
+++ b/lib/Bot/Zulip/Chess.pm
@@ -189,7 +189,14 @@ sub draw_state ($self) {
$board .= "\nCHECK\n";
}
- $board .= "\@**" . $self->current_player . "** ("
+ my $to_move = $self->current_player;
+ if ($to_move) {
+ $to_move = '@**' . $to_move . '**';
+ }
+ else {
+ $to_move = "A new opponent";
+ }
+ $board .= $to_move . " ("
. ($self->_chessboard->to_move ? 'White' : 'Black')
. ") to move";