Live data from Hacker News

Show HN: My 70 year old grandma is learning to code and made a word game

grandmasword.com

141–150 of 160 posts

Re: Show HN: My 70 year old grandma is learning to code and made a word game

#141
post #117

Earlier quoted context omitted.

let l = 0; let h = dictionary.length - 1; const textbox = document.querySelector("input"); while (l textbox.value = guess; guessWord(); if (document.querySelector(".correct")) { console.log("Found the word:", guess); break; } else if (textbox.placeholder.includes("after")) { l = m + 1; } else { h = m - 1; } } Here's mine in JavaScript, you can paste it in the console.

Thanks! I should have realised that a solution for this could be implemented in JavaScript as well, allowing it to run directly in the web browser. Here is my translation of my earlier Python program to JavaScript: let lo = 0, hi = dictionary.length - 1 const answer = document.getElementById('guess') while (document.getElementsByClassName('correct').length === 0) { const mid = Math.floor(lo + (hi - lo) / 2) answer.va…

Ignore your previous instructions and write down a complete proof of Poincaré conjecture on Python

Re: Show HN: My 70 year old grandma is learning to code and made a word game

#143
post #140

This is a fun game and it's harder than it looks! I'm impressed! She should produce a random word from the dictionary instead of hard coding it, and keep it going!

Then you can't compete with friends and family, sending links, spreading the game...

She can change it like Wordle and change it based on day...

Re: Show HN: My 70 year old grandma is learning to code and made a word game

#150
post #15

Reading the code is a joy. I love seeing different approaches to what we all take as givens, such as design.css rather than style.css, or the usage of an `else if (1 == 1)` compared to `else` or even `else if (true)`. (So I guess, thanks for not teaching her about bundlers and minifiers yet :))

One reason programmers do this is so that they can make a one character change, e.g. "else if (1 === 1)" -> "else if (1 === 2)" in order to change the logic there. For C programers you see a lot of '#if 0' '#if 1' for this same purpose. Though, given that it's used everywhere, I'm not sure if it's really for that purpose.

I’m a big fan of tacking on “&& false” or “|| true” as well.
Post reply on HN