Live data from Hacker News

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

grandmasword.com

111–120 of 160 posts

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

#114
post #62
post #46

Earlier quoted context omitted.

> Not to be negative or anything but [pure shade] I'm gonna bet that my mom has had a website since before you were born*. She was taking fortran classes in the 60s. Your ageist attitude is pretty gross. So what if she had help? Another bet, you can't program without the help of online resources and/or a chatbot either. * given the dates on your resume, there's a very good chance I'm correct in this

What a spiteful comment over a little skepticism

[deleted]

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

#117
post #90

Caution: Spoilers in this comment! Arriving a bit late to the party, but I couldn't resist crafting a quick binary search solution in Python. from urllib.request import urlopen, Request DICT_URL = "https://grandmasword.com/dictionary.js" response = urlopen(Request(DICT_URL, headers={"User-Agent": "Mozilla/5.0"})) words = [w.strip('"[];\n') for w in response.read().decode().split("[")[1].split(",")] lo, hi, answer = 0…

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.value = dictionary[mid]
    guessWord()
    if (answer.placeholder.indexOf('after') !== -1) {
      lo = mid + 1
    } else {
      hi = mid - 1
    }
  }
This solution is quite similar to yours. Thanks for this nice idea!

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

#120
post #62
post #46

Earlier quoted context omitted.

> Not to be negative or anything but [pure shade] I'm gonna bet that my mom has had a website since before you were born*. She was taking fortran classes in the 60s. Your ageist attitude is pretty gross. So what if she had help? Another bet, you can't program without the help of online resources and/or a chatbot either. * given the dates on your resume, there's a very good chance I'm correct in this

What a spiteful comment over a little skepticism

I'd characterize the original comment as a cynical accusation of shilling, so I'm quite curious what you read as "spite" in mine. Must I point out that I, too, use external resources whilst programming?
Post reply on HN