Battleship: Draw border on right and bottom too

This commit is contained in:
Pragmatic Software 2018-07-05 15:34:40 -07:00
parent 9f54843e40
commit 1231c7b682
1 changed files with 18 additions and 0 deletions

View File

@ -977,9 +977,27 @@ sub show_battlefield {
$buf .= "$self->{board}->[$y][$x] ";
}
}
$buf .= sprintf("$color{cyan}%c", 97 + $y);
$buf .= "$color{reset}\n";
}
# bottom border
$buf .= "$color{cyan} ";
for($x = 1; $x < $self->{N_X} + 1; $x++) {
if ($x % 10 == 0) {
$buf .= $color{yellow} if $self->{N_X} > 10;
$buf .= $x % 10;
$buf .= ' ';
$buf .= $color{cyan} if $self->{N_X} > 10;
} else {
$buf .= $x % 10;
$buf .= ' ';
}
}
$buf .= "\n";
my $player1 = $self->{player}->[0]->{nick};
my $player2 = $self->{player}->[1]->{nick};