From c7e0ca3b8a001ccbdf5bbbbdeeecfcc25360dc35 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Thu, 13 Jan 2022 20:06:54 -0500 Subject: vordle vill pick a vord for you --- wordle.pl | 18 ++++++++++++++---- 1 file 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; -- cgit v1.2.1