Merge branch 'master' of github.com:E-Almqvist/prog2

master
E. Almqvist 3 years ago
commit 1322f5f1ba
  1. 15
      prog2/wordle/calc.rb
  2. 13
      prog2/wordle/thing.sh

@ -46,9 +46,14 @@ end
calc_stuff(charpos_count, most_common_pos)
pos1 = ARGV[0].to_i
pos2 = ARGV[1].to_i
(pos1..pos2).each do |i|
print "#{most_common_pos[i][:char]}"
if( ARGV.length >= 2 ) then
pos1 = ARGV[0].to_i
pos2 = ARGV[1].to_i
(pos1..pos2).each do |i|
print "#{most_common_pos[i][:char]}"
end
puts ""
else
p most_common_pos
p char_count
end
puts ""

@ -2,10 +2,15 @@
words=/usr/share/dict/words
thing=$(ruby calc.rb $1 $2)
if [ -z "$2" ]
then
echo "Usage: $ thing.sh (lower bound) (upper bound)"
echo "Example: $ thing.sh 0 1"
echo "The above example will output the best words that match first and second characters."
exit
fi
echo $thing
thing=$(ruby calc.rb $1 $2)
fivewords=$(cat $words | awk '{print tolower($0)}' | grep -E '^[[:alpha:]]{5}$')
echo $fivewords
#| grep -E '\b${thing}'
echo $fivewords | sed 's/ /\n/g' | grep -E "^${thing}"

Loading…
Cancel
Save