summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@fastmailteam.com>2022-01-13 20:06:54 -0500
committerCalvin Morrison <calvin@fastmailteam.com>2022-01-13 20:06:54 -0500
commitc7e0ca3b8a001ccbdf5bbbbdeeecfcc25360dc35 (patch)
tree1810620168cfe3a6e9c9310b44fa88a39d75163d
parentf95d9377d2cd402c1136d610bd346204fe69f4ba (diff)
vordle vill pick a vord for you
-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;