summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wordle.pl18
1 files changed, 14 insertions, 4 deletions
diff --git a/wordle.pl b/wordle.pl
index 716c37c..21f9716 100644
--- a/wordle.pl
+++ b/wordle.pl
@@ -12,13 +12,23 @@ use List::Util qw/shuffle/;
say "welcome to my wordle pass filter program, where it tries to guess your wordle\n";
-$| = 1;
-# word len determines number of guesses and dict filter.
-my $answer = $ARGV[0];
-my $wlen = length($answer);
+# flush for the drama
+$| = 1;
# load dictionary
my @words = read_file("dictionary.txt", chomp => 1);
+
+my $answer = "";
+if ($#ARGV < 1) {
+ $answer = $words[int rand@words];
+ say "fine i will play with myself! I will try to guess... $answer\n";
+} else {
+ say "i will try to guess $answer\n";
+ $answer = $ARGV[0];
+}
+
+my $wlen = length($answer);
+
say "total dict size: " . scalar @words;
my $total = scalar @words;