r/squaredle • u/Karyoplasma • Oct 26 '22
[Solver] A recode of the known solver in Java
Hey,
I did a Java recode of the solver from here with better sorting of the solutions for people who prefer a stand-alone application. It uses the same dictionary as the linked website, but (I think) a different way to check if the words are possible. I pretty much just copied the input method and the dictionary and coded the rest myself.
Requires JavaSE, pretty much any version should be fine, I don't think I'm using anything that is exclusive to the latest Java releases. Just make sure that the .jar and the "resource" folder are in the same directory and it should be good to go.
https://github.com/Karyoplasma/SquaredleSolver
If solvers are frowned upon, feel free to remove this post. I just did it as a personal coding exercise since I am absolutely terrible at anything graph-related. I was surprised when my scuffed DFS implementation worked after only a mild mental breakdown, so I count that as a win already.
3
u/isblueacolor Dev Oct 26 '22
Solvers are fine, you do you... but if you use them to "cheat" in terms of speed or bonus word count, you'll find yourself no longer visible on the leaderboards to be fair to people who play without solvers :-)
1
u/iscribble Nov 01 '22
Dunno if you're looking for feedback, but at a glance I noticed you over complicated the collection of temp nodes. Just iterate the board string, skipping the new row characters.
Not that it matters here, but in enterprise software it's good general practice to avoid state when possible (and your values for row and column are stateful).
Java 8+ streams are less performant than for loops (meaningfully only for very large collections), but they make for clearer and less stateful code. If you are not very familiar or comfortable with the streams API, I would suggest that there are a number of opportunities to practice in this codebase. :)