summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-06-02 20:54:01 -0500
committerJesse Luehrs <doy@tozt.net>2009-06-02 21:15:27 -0500
commitb0223acdfe64b78e65c8f1a801763ea7bc4f3197 (patch)
treee715e5cc689c9a595968ca308617e1769786f405
parent492128b96d195ba9813053bd72a09c334019beb7 (diff)
downloadbot-games-b0223acdfe64b78e65c8f1a801763ea7bc4f3197.tar.gz
bot-games-b0223acdfe64b78e65c8f1a801763ea7bc4f3197.zip
add a resign command for chess
-rw-r--r--lib/Bot/Games/Game/Chess.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Bot/Games/Game/Chess.pm b/lib/Bot/Games/Game/Chess.pm
index f196a09..25f550e 100644
--- a/lib/Bot/Games/Game/Chess.pm
+++ b/lib/Bot/Games/Game/Chess.pm
@@ -56,6 +56,15 @@ around allow_new_player => sub {
return $self->$orig(@_);
};
+command resign => sub {
+ my $self = shift;
+ my ($dummy, $args) = @_;
+ $self->is_active(0);
+ return "$args->{player} resigns: "
+ . App::Nopaste::nopaste(text => $self->game->dump_pos,
+ nick => $args->{player})
+};
+
sub format_turn {
my $self = shift;
my ($turn) = @_;