diff options
author | Calvin Morrison <calvin@fastmailteam.com> | 2022-01-13 20:06:54 -0500 |
---|---|---|
committer | Calvin Morrison <calvin@fastmailteam.com> | 2022-01-13 20:06:54 -0500 |
commit | c7e0ca3b8a001ccbdf5bbbbdeeecfcc25360dc35 (patch) | |
tree | 1810620168cfe3a6e9c9310b44fa88a39d75163d | |
parent | f95d9377d2cd402c1136d610bd346204fe69f4ba (diff) |
vordle vill pick a vord for you
-rw-r--r-- | wordle.pl | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -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; |