Hello HN!
I've been playing a lot with <a href="https://hyperscript.org/" rel="nofollow">https://hyperscript.org/</a> 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.<p>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!
This is awesome, but there's a slight bug in this implementation: Wordle won't count additional instances of a letter as wrong-position, it'll just flag them as wrong. For example, if the word is TRACE, and I guess TRACT, the first T will be green, but the second T should be black, not yellow. In this implementation, at the moment, TRACT would return GGGGY, but in Wordle it would be GGGGB.<p>I 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.
I found a bug. When there is a repeated character in the guess but not in the word, you’re given an incorrect color key.<p>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.
Wow, first time I see hyperscript. It is so remote from what I am used to, I have no idea how to read the code in details, but what it does is completely self-explanatory.
On Safari on iOS, at least, typing fast will accidentally zoom into that part of the page instead of registering it as a character press.<p>But pretty neat implementation otherwise. Awesome work!
I made a simple Wordle clone in ~70 lines without using Hyperscript.<p><a href="https://dougmcleod.ca/share/wordle.html" rel="nofollow">https://dougmcleod.ca/share/wordle.html</a>
This isn't just a beautiful demonstration of Hyperscript, it could also be a great introduction to what it can be like when writing for the web platform, or to coding in general. Well done!
I'm confused. Hyperscript is supposed to be an alternative way to writing JSX, good for skipping the babel/transpile step. Such as the React h() function. For example:<p><pre><code> h('header', { id: 'my-header', className: 'header' },
h('div', { className: 'logo' },
h('a', { href: '/' }, 'mtsknn.fi')
)
)
</code></pre>
Hyperscript.org doesn't seem to be related to this at all?<p><a href="https://mtsknn.fi/blog/hyperscript-hyperior-alternative-to-jsx/" rel="nofollow">https://mtsknn.fi/blog/hyperscript-hyperior-alternative-to-j...</a>
<a href="https://dev.to/fromaline/hyperscript-the-hidden-language-of-react-3d1f" rel="nofollow">https://dev.to/fromaline/hyperscript-the-hidden-language-of-...</a>
Nice work! I spent some time playing with this today and used it to build a solver algorithm. It's a greedy search through the possible combinations that prioritizes words based on letter frequency and uses the hints provided to whittle down the search space.<p>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!<p>Anyone have a better algo yet? <a href="https://github.com/rgkimball/wordlebot" rel="nofollow">https://github.com/rgkimball/wordlebot</a>
Nice. Is there a link to the 60 (63) lines of source code? It's not obvious on mobile at least?<p>Ed, nevermind:<p>> I highly suggest going to the site and viewing the source!<p>For chrome on Android:<p><pre><code> view-source:https://arhamjain.com/hyperwordle/</code></pre>
> build 80% of Wordle in a different language<p>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.<p>I will dig into yours and see how it can be adapted to different languages too :)
Doesn't work for me, getting a JS error when I'm entering a word:<p>hyperscript.org@0.9.4:1 'first <:empty/> in first .guess' is null
Hyperscript already has an established meaning in this space, as a pure JS-based syntax alternative to JSX.<p>See <a href="https://github.com/hyperhype/hyperscript" rel="nofollow">https://github.com/hyperhype/hyperscript</a> and all its descendants, like Mithril, HyperApp or Sinuous.<p>Could you please think of another name ?