Show HN: A simple Wordle clone in 60 lines, using Hyperscript (arhamjain.com)
Hello HN!
I've been playing a lot with https://hyperscript.org/ recently (not to be confused with the other hyperhype hyperscript). I threw together a quick Wordle clone in an evening to see what it would look like using this language. The main functionality that is missing is checking for invalid words. The word dictionary is also very small, so it's very easy.
The goal here wasn't really to create a good version of Wordle, it was to build 80% of Wordle in a different language to see what it looks like. Turns out, it looks pretty good! Stuff like using CSS rule precedence to highlight the squares, CSS selectors to figure out which key to highlight, and using the DOM to keep state are all really natural in Hyperscript. I highly suggest going to the site and viewing the source!
52 comments
[ 4.9 ms ] story [ 142 ms ] threadI actually made the same mistake in a Wordle solver I was writing recently - it's easy to miss, since Wordle doesn't make this explicit and you have to infer it yourself.
guess: "SASSY", target: "BRASS", expect either "YYBGB" or "BYYGB". I believe your algorithm would return "YYYGB".
guess: "BRASS", target: "SASSY", expect "BBYGY"
guess: "ASSET", target: "BRASS", expect "YYYBB"
guess: "BRASS", target: "ASSET", expect "BBYYY"
It'd be very easy to check against just a list of words, but that'd require more storage and be slower than a bloom filter.
E.g. Word was GROUP I guessed SPOON Output was green O at location 3 and yellow at 4. Happened for a couple more guesses making me think there is another O eventually to realize there are no more spots and it’s a bug.
Turns out, HN finds and reports bugs much faster than family and friends :)
Of course 168kB is still nothing but your comparison is flawed.
the size is not an issue
now, the runtime on the other hand...
the hyperscript runtime is defintely... pedestrian
See https://github.com/hyperhype/hyperscript and all its descendants, like Mithril, HyperApp or Sinuous.
Could you please think of another name ?
https://github.com/bigskysoftware/_hyperscript
https://hyperscript.org/
but not sure it's anything to do with the OP though
I seems they want to pull a Substack. Color me unimpressed.
@dang if you happen to read this, can you hide/flag the thread ?
I have been trying to do the same thing! I was looking for projects on github that I could adapt to a new language. Sadly, most of them require a server. It seemed to me that this game could pretty easily just run on the client alone.
I will dig into yours and see how it can be adapted to different languages too :)
But pretty neat implementation otherwise. Awesome work!
will be a great chance to optimize the hyperscript runtime for mobile
https://mtsknn.fi/blog/hyperscript-hyperior-alternative-to-j... https://dev.to/fromaline/hyperscript-the-hidden-language-of-...
Ed, nevermind:
> I highly suggest going to the site and viewing the source!
For chrome on Android:
Though not enforced by the Hyperwordle clone, the script plays the game on "hard" mode by default where all letter hints must be included in subsequent guesses. Ironically, this constraint made the algorithm more efficient, easy mode tends to take longer and fail more frequently!
Anyone have a better algo yet? https://github.com/rgkimball/wordlebot
hyperscript.org@0.9.4:1 'first <:empty/> in first .guess' is null
https://dougmcleod.ca/share/wordle.html