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
Way waaaaaay faster algorithmโฆ takes seconds instead of minutes/hours #3
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Technically
|
dlenski
added a commit
that referenced
this pull request
Jan 16, 2022
I was allocating too much memory here, by a factor of sizeof(char *)/sizeof(char). Thanks @HenkPoley for pointing this out. #3 (comment)
Thank you, @HenkPoley, fixed that dumb mistake. ๐คฆโโ๏ธ |
dlenski
added a commit
that referenced
this pull request
Jan 16, 2022
I was allocating too much memory here, by a factor of sizeof(char *)/sizeof(char). Thanks @HenkPoley for pointing this out. #3 (comment)
dlenski
force-pushed
the
way_fast_algorithm
branch
from
January 16, 2022 05:08
0470a16
to
1bd314f
Compare
Where we're going, we don't need these. ๐๐ปโโ๏ธ
Say hello to my blazingly fast new O(N^2) algorithm. ๐๐ป๐ญ๐ง ๐ก๐จ๐ปโ๐ป๐โฆ๐ฎโฉ๐๐ปโโ๏ธ Old/tired: - Took 1/2 hour to churn through the 4,595 5-letter words in /usr/share/dict/american-english, on one core of my i7-8665U, even after some tricky micro-optimization for how to store the guesses. - Took many hours for the 12,972 5-letter words in the CSW2019 (Collins Scrabble Wordlist 2019). New/wired: - Takes <1 second to for /u/s/d/american-english - Takes <3 seconds for CSW2019
โฆaightforward with cluniques
I was allocating too much memory here, by a factor of sizeof(char *)/sizeof(char). Thanks @HenkPoley for pointing this out. #3 (comment)
As explained in the comment at top already, there are actually only (3^L - L) possible "clunique" categories, not (3^L), because having (L-1) RightPosition clues and 1 WrongPosition clue is logically impossible by the pigeonhole principle. We should report this accurately in the statistics.
dlenski
force-pushed
the
way_fast_algorithm
branch
from
January 16, 2022 23:27
1bd314f
to
9dd5841
Compare
dlenski
added a commit
that referenced
this pull request
Feb 1, 2022
I was allocating too much memory here, by a factor of sizeof(char *)/sizeof(char). Thanks @HenkPoley for pointing this out. #3 (comment)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been thinking about this a lot, and suddenly figured out how to do it while out for a run.
๐๐ป๐ญ๐ง ๐ก๐จ๐ปโ๐ป๐โฆ๐ฎโฉ๐๐ปโโ๏ธ
I thought we needed O(_N_ร_M_ยฒ) runtime to figure out the best next guess (O(_N_ยณ) for the first guess). But no!
It's possible to figure out the best next guess in O(N_ร_M) (O(_N_ยฒ) for the first guess).
The way to do it isโฆ actually amazingly simple and beautiful.
8128325
for the change to the algorithm.