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.
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.
Not take away from the brevity of the code, but these 60 lines translate into 168KB of JavaScript.
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.
But pretty neat implementation otherwise. Awesome work!
Does not check for real words.
I made a simple Wordle clone in ~70 lines without using Hyperscript.
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:
h('header', { id: 'my-header', className: 'header' },
h('div', { className: 'logo' },
h('a', { href: '/' }, 'mtsknn.fi')
)
)
Hyperscript.org doesn't seem to be related to this at all?https://mtsknn.fi/blog/hyperscript-hyperior-alternative-to-j... https://dev.to/fromaline/hyperscript-the-hidden-language-of-...
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.
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
Wordle will become the new todolist
Nice. Is there a link to the 60 (63) lines of source code? It's not obvious on mobile at least?
Ed, nevermind:
> I highly suggest going to the site and viewing the source!
For chrome on Android:
view-source:https://arhamjain.com/hyperwordle/
> build 80% of Wordle in a different language
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 :)
holy smokes, that's some seriously sweet hyperscript
Doesn't work for me, getting a JS error when I'm entering a word:
hyperscript.org@0.9.4:1 'first <:empty/> in first .guess' is null
Doesnt validate input as words,
every key press takes 4 seconds to update the ui, if this is supposed to be a showcase for hyperscript, its not doing too well.
it's buggy and accepts bogus words
Hyperscript already has an established meaning in this space, as a pure JS-based syntax alternative to JSX.
See https://github.com/hyperhype/hyperscript and all its descendants, like Mithril, HyperApp or Sinuous.
Could you please think of another name ?
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.
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.