Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factor out common functions in notebooks + Perf Improvements + max-splits heuristic #6

Merged
merged 1 commit into from Jan 12, 2022

Conversation

vtjeng
Copy link
Contributor

@vtjeng vtjeng commented Jan 12, 2022

  • We factor out common functions in performance.ipynb and wordle_solver.ipynb into a single utils file. This will make code reviews in the future simpler, since diffs of .jl files display better than those for .ipynb files.
  • Significantly improve the performance of the code in performance.ipynb by using a 2d-array to store the precomputed scores rather than a dictionary, and by making the score a UInt8, which takes up less space.
    • w/o hard mode, computing using all words goes from 900s -> 200s
    • Implementation:
      • get_group_sizes, find_move, trim_pool, apply_strategy and get_num_turns make use of type polymorphism to handle either an Int (corresponding to the index of the word in the list of all words) or a String (the word itself).
      • In addition, to get the score to fit in a UInt8, we treat the scores as ternary (e.g. 22222 in base 3 is 242 in base 10).
  • Add charts for max-splits heuristic + hard mode with all guesses.
    • Max-splits seems to perform consistently best on every metric for hard mode.

NOTE: You'll see that there's some differences in our histograms. I haven't been able to dig in to exactly what the issues are, but I suspect it has to do with the change to tiebreaks (from lexical order on strings to the position of the words in the guessing list).

@LaurentLessard LaurentLessard merged commit 8456f6e into LaurentLessard:main Jan 12, 2022
@vtjeng vtjeng deleted the vtjeng/refactor branch January 15, 2022 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants