Show HN: My 70 year old grandma is learning to code and made a word game
grandmasword.com
grandmasword.com
Now trolling here
https://www.reddit.com/r/programming/comments/1enuhw5/commen...
> /* This makes the words flip over like in Wordle. Ask Gary if we can change it to letter by letter like wordle */
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, len(words) - 1, ""
while answer != "d":
mid = lo + (hi - lo) // 2
print(words[mid])
answer = input("after/before/done? [abd] ")
if answer == "a":
lo = mid + 1
elif answer == "b":
hi = mid - 1
Took a total of 17 guesses to find the solution: MALPIGHIAS
after/before/done? [abd] a
RUBIFIES
after/before/done? [abd] a
TEARERS
after/before/done? [abd] a
UNMANLIEST
after/before/done? [abd] a
VORTICES
after/before/done? [abd] b
UTOPIANIZING
after/before/done? [abd] a
VERTICILLASTERS
after/before/done? [abd] a
VIROSE
after/before/done? [abd] a
VIZARD
after/before/done? [abd] a
VOLCANISE
after/before/done? [abd] a
VOLUMIZER
after/before/done? [abd] b
VOLPINOS
after/before/done? [abd] b
VOLITATE
after/before/done? [abd] b
VOLCANOLOGICAL
after/before/done? [abd] b
VOLCANIZATION
after/before/done? [abd] a
VOLCANIZES
after/before/done? [abd] a
VOLCANO
after/before/done? [abd] d
Thanks for sharing this nice game on a fine Sunday evening! It was fun to play both manually as well as programmatically!const textbox = document.querySelector("input");
while (l <= h) { const m = Math.floor((l + h) / 2); const guess = dictionary[m]; const textbox = document.querySelector("input"); console.log("Guessing:", guess);
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.
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!Edit: See also https://news.ycombinator.com/item?id=41217457.
I'm just jealous to granma doesn't understand DNS
A small bug report: the "Share score" button on macOS Safari doesn't offer "copy" as an option for some reason. The same functionality on guess the game[0] has the same limitation, but it also copies to the clipboard automatically. Wordle[1] seems to just copy to the clipboard only.
Suggestions, limit to 5 chars and use a Wordle-like interface so your phone can’t suggest words.
I could see this being a legit NYT game.
If you guess a word that isn’t in the dictionary, the text box looks like it’s cleared but my phone’s (iPhone) keyboard’s autocomplete either didn’t pick that up or there’s still some hidden content in the box.
It would be nice if the list was always sorted in totality.
(So I guess, thanks for not teaching her about bundlers and minifiers yet :))
view-source gives away the answer for the next 20 days....
It's a very interesting concept as I'm sure you can extract some interesting insight about the profile of a user from the list of 12+ words they'll come up with. (When looking back at most of mine, they're words that came up in this week's conversations or lyrics of my Spotify playlists)
Like, it might be a fascinating little add-on to have a "Rorschach" LLM-based module attached which looks at the vocabulary you used and tries to sketch out a cold reading about you.
I would come up with categories of increasing difficulty. "Colors", "Advanced Colors", "Common Fruit", "All Fruit", etc.
The game mechanic is great and worked flawlessly though!
There's also the case of the 80-some-year-old Japanese lady who wrote her own iPhone app, a game about arranging traditional Japanese paper dolls: https://social-innovation.hitachi/en/article/colors-wakamiya...
If you're retired, bored, and have a lot of time on your hands, learning tech proficiency and programming seems a good way to pass the time and help keep your mind sharp. Just as it was for us bored kids back in the day.
It was volcano but I only discovered it after finding that Android autocorrect can suggest a word for me.
If you like this, check out https://betweenle.com.
Betweenle is based on the same game logic, but gives you very useful visual clues along the way.
I got reeeealy close (and then asked an llm....)
Congrats to your grandma for making a game!
- It can work for multiple age ranges by varying word lengths - It has good replay-ability - It can be adapted for offline play - It can be adapted for learners of new languages as well
Feature request - colour code incorrect guesses by distance from the solution. You could look up 'Hamming distance' for one approach to that.
Vodka should not be below voice.
My word is between Vodka and Vomit :D
The optimal strategy would be to do a binary search which would take longer than 5.
secretWords = ['test', 'test', 'test', 'horse', 'chocolate', 'garden', 'volcano', 'orange', 'elephant', 'star', 'violin', 'egg', 'pencil', 'forest', 'lamp', 'island', 'potato', 'happy', 'toilet', 'shell'];Edit: I got it in 18 guesses
What does this mean? You could say the same thing about Wordle.
https://www.mit.edu/~ecprice/wordlist.10000
It is on this list of 20000 words:
https://gist.github.com/eyturner/3d56f6a194f411af9f29df4c9d4...
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
Your comment is also much much ruder than the one you're replying to.
I will learn new things until the day I can't. I am currently learning the Stan language but I am not going to write a medium article "What happens when an old man attempts to learn Stan?"
…ooooh I see the 20 secretWords now
My own 74 year old surviving parent would never be able to get them selves to even try, as they have spent most of their lives telling reiterating a mantra about how little they know about technology.
It has been a guiding principle of mine to never do that with anything, after seeing the effect it has had on her.
https://www.reddit.com/r/programming/comments/1enuhw5/my_70_...
Doesn't anyone else remember being a beginner? This isn't something I would have made. It has too many extra little nuances. The dictionary is a big clue.
"it's my birthday today [AI generated image of Grandma with birthday cake]" is a viable business model on Facebook these days: https://www.404media.co/where-facebooks-ai-slop-comes-from/
If they get enough clicks they could put profitable ads on the page, or even sell it (like what happened with Wordle).
Get the chatter going, get "press", clicks, visitors and players, then potentially ads, or selling the site (for someone else to put even more ads on it), or using it as marketing reference (I made a game viral by lying about it).
Anyway, the grandma story has been exposed as fake.
I convinced her that she can figure out any remote and they are designed to be figured out. I told her at most there’s gonna be 5 buttons she doesn’t understand and it won’t break anything to hit them. Most of the buttons are numbers or volume and channel up down, power.
She got that. When her mom was sick and had different tvs because of different circumstances my mom would be like, “I did figure out the remote tho and was able to get the television working.”
I was with my 3 year old niece the other day and she turned on the receiver and then the television and I said , “wow, I’m impressed you figured that out.” And she said , “yeah when grandma watches me she doesn’t know how”. . .
And I tell myself that every day as I try to learn guitar in my 40’s.
import requests
url = 'https://grandmasword.com/dictionary.js'
response = requests.get(url)
lines = response.text.split('\n')[2:]
exec('\n'.join(lines))
def binary_search(dictionary):
while len(dictionary) > 1:
mid_index = len(dictionary) // 2
mid_word = dictionary[mid_index]
print(f"Guess this middle word: {mid_word}")
user_input = input("Did grandma say her word is before or after? (type b or a)").strip().lower()
dictionary = dictionary[:mid_index] if user_input == "b" else dictionary[mid_index + 1:]
print(f"Grannys word: {dictionary[0]}" if dictionary else "No words left in the dictionary.")
binary_search(dictionary)
Solved in 18 guesses!
Share score
Thank you for visiting my website. There'll be a new word everyday just like Wordle. Kind regards, EleanorHmmm...
> <!-- When the player pressed Enter it should start the guessWord. Need to test on phone -→
Hopefully a new version will be released free of charge for current customers.