From 7f1c579ea664fd007ca68f639a1ba22dd78052f8 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 22 Oct 2014 15:46:03 -0400 Subject: handle the case of the first turn --- lib/Bot/Zulip/Chess.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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"; -- cgit v1.2.3