Skip to content

Commit

Permalink
Merge pull request #1 from hayden1126/dev
Browse files Browse the repository at this point in the history
added 1wu function and 1gp function
  • Loading branch information
hayden1126 authored Mar 7, 2023
2 parents cca1108 + 4985e03 commit 6efd9f6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 10 additions & 1 deletion run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ function check_commands(input::String)::Bool
elseif input == "1w"
open_in_default_browser("https://www.nytimes.com/games/wordle/index.html")
println(BOLD, LIGHT_BLUE_FG, "Launched Wordle in your browser")
elseif input == "1wu"
open_in_default_browser("https://wordleunlimited.org/")
println(BOLD, LIGHT_BLUE_FG, "Launched Wordle Unlimited in your browser")
elseif startswith(input, "1g")
if length(input) > 3 && all(isnumeric, input[4:end])
number = parse(Int, input[4:end])
Expand All @@ -174,9 +177,15 @@ function check_commands(input::String)::Bool
else
number = 5
end
view_possible(filter_guesses(POSSIBLE, CORRECTLETTERS, WRONGLETTERS, LOCKED[end], number), false)
if startswith(input, "1gp")
view_possible(filter_possibleguesses(POSSIBLE, CORRECTLETTERS, WRONGLETTERS, LOCKED[end], number), false)
else
view_possible(filter_guesses(POSSIBLE, CORRECTLETTERS, WRONGLETTERS, LOCKED[end], number), false)
end
elseif input == "1h" || input == "help" || input == "?"
println(BOLD, LIGHT_BLUE_FG, "1e/exit: ", WHITE_FG, "End program")
println(BOLD, LIGHT_BLUE_FG, "1g: ", WHITE_FG, "View recommended guesses within all words")
println(BOLD, LIGHT_BLUE_FG, "1gp: ", WHITE_FG, "View recommended guesses within Possible words only")
println(BOLD, LIGHT_BLUE_FG, "1v: ", WHITE_FG, "View filtered list of words")
println(BOLD, LIGHT_BLUE_FG, "1av: ", WHITE_FG, "Automatic view of filtered list of words")
println(BOLD, LIGHT_BLUE_FG, "1avoff: ", WHITE_FG, "Turn off automatic view")
Expand Down
9 changes: 9 additions & 0 deletions src/recommend.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,13 @@ function filter_guesses(possible::Vector{String}, correct::Set{Char}, wrong::Set
wordcount, repeatcount = word_count(possible)
sort!(guesses, by = x -> (score(x, wordcount, repeatcount, correct, wrong, locked, len)), rev = true)
return guesses[1:number]
end

function filter_possibleguesses(possible::Vector{String}, correct::Set{Char}, wrong::Set{Char}, locked::Vector{Char}, number::Int=5)::Vector{String}
len = length(possible)
if len == 2 return possible end
guesses = deepcopy(possible)
wordcount, repeatcount = word_count(possible)
sort!(guesses, by = x -> (score(x, wordcount, repeatcount, correct, wrong, locked, len)), rev = true)
return guesses[1:number]
end

0 comments on commit 6efd9f6

Please sign in to comment.