diff options
author | doy <doy@tozt.net> | 2009-04-25 12:29:47 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2009-04-25 12:29:47 -0500 |
commit | fd70eb77e3d8ef6f907eccdf0d9735a4280eef75 (patch) | |
tree | 35c5e21ae90b9566b5f592b54fc2c4cab40d4c9c /lib/Bot/Games/Game/Ghost.pm | |
parent | 82ce96adf83a63ee8b38cb6d711097ce379ee320 (diff) | |
download | bot-games-fd70eb77e3d8ef6f907eccdf0d9735a4280eef75.tar.gz bot-games-fd70eb77e3d8ef6f907eccdf0d9735a4280eef75.zip |
fix up a bunch of challenging issues in the ghost games
Diffstat (limited to 'lib/Bot/Games/Game/Ghost.pm')
-rw-r--r-- | lib/Bot/Games/Game/Ghost.pm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Bot/Games/Game/Ghost.pm b/lib/Bot/Games/Game/Ghost.pm index 740ecd2..29d75e9 100644 --- a/lib/Bot/Games/Game/Ghost.pm +++ b/lib/Bot/Games/Game/Ghost.pm @@ -93,11 +93,11 @@ command challenge => sub { } elsif ($self->valid_word($word)) { $self->is_over(1); - return "$word is a word! $challenger wins!"; + return "$word is a word! $challenger loses!"; } else { $self->is_over(1); - return "$word is not a word. $challenger loses!"; + return "$word is not a word. $challenger wins!"; } } else { @@ -128,7 +128,8 @@ command valid_move => sub { command valid_word_from_state => sub { my $self = shift; my ($word) = @_; - return uc($word) eq $self->state; + my $word_prefix = substr($word, 0, length($self->state)); + return uc($word_prefix) eq $self->state; }; command give_up => sub { |