mirror of
https://github.com/pragma-/pbot.git
synced 2025-07-04 04:27:29 +02:00
Plugin/Wordle: fix hard mode minimum letter requirements; test hard mode validation before word existence check; replace "is not" with "can't be"
This commit is contained in:
parent
b61dbe17c6
commit
30ac705d99
@ -496,10 +496,6 @@ sub guess_wordle($self, $channel, $guess) {
|
||||
return "Guess length ($guess_length) unequal to Wordle length ($wordle_length). Try again.";
|
||||
}
|
||||
|
||||
if (not exists $self->{$channel}->{guesslist}->{$guess}) {
|
||||
return "I don't know that word. Try again.";
|
||||
}
|
||||
|
||||
my @guess = split //, $guess;
|
||||
my @wordle = $self->{$channel}->{wordle}->@*;
|
||||
|
||||
@ -521,7 +517,7 @@ sub guess_wordle($self, $channel, $guess) {
|
||||
|
||||
foreach my $orange ($self->{$channel}->{oranges}->@*) {
|
||||
if ($guess[$i] eq $orange->[$i]) {
|
||||
return "Hard mode is enabled. Position " . ($i + 1) . " is not $guess[$i]. Try again.";
|
||||
return "Hard mode is enabled. Position " . ($i + 1) . " can't be $guess[$i]. Try again.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -535,8 +531,8 @@ sub guess_wordle($self, $channel, $guess) {
|
||||
foreach my $o (keys %oranges) {
|
||||
my $count = 0;
|
||||
$_ eq $o && $count++ foreach @guess;
|
||||
if ($count < $oranges{$o}) {
|
||||
return "Hard mode is enabled. There must be $oranges{$o} $o. Try again.";
|
||||
if ($count < $oranges{$o} + $greens{$o}) {
|
||||
return "Hard mode is enabled. There must be " . ($oranges{$o} + $greens{$o}) . " $o. Try again.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -544,7 +540,7 @@ sub guess_wordle($self, $channel, $guess) {
|
||||
foreach my $white ($self->{$channel}->{whites}->@*) {
|
||||
for (my $i = 0; $i < @guess; $i++) {
|
||||
if ($guess[$i] eq $white->[$i]) {
|
||||
return "Hard mode is enabled. Position " . ($i + 1) . " is not $guess[$i]. Try again.";
|
||||
return "Hard mode is enabled. Position " . ($i + 1) . " can't be $guess[$i]. Try again.";
|
||||
}
|
||||
|
||||
if (not $self->{$channel}->{letter_max}->{$white->[$i]}) {
|
||||
@ -567,6 +563,10 @@ sub guess_wordle($self, $channel, $guess) {
|
||||
}
|
||||
}
|
||||
|
||||
if (not exists $self->{$channel}->{guesslist}->{$guess}) {
|
||||
return "I don't know that word. Try again.";
|
||||
}
|
||||
|
||||
$self->{$channel}->{guess_count}++;
|
||||
|
||||
my %count;
|
||||
|
@ -25,8 +25,8 @@ use PBot::Imports;
|
||||
# These are set by the /misc/update_version script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 4868,
|
||||
BUILD_DATE => "2025-06-26",
|
||||
BUILD_REVISION => 4869,
|
||||
BUILD_DATE => "2025-07-02",
|
||||
};
|
||||
|
||||
sub initialize {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user