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, EleanorShow HN: My 70 year old grandma is learning to code and made a word game
21–30 of 160 posts
time to LLM a binary search
Re: Show HN: My 70 year old grandma is learning to code and made a word game
#22Re: Show HN: My 70 year old grandma is learning to code and made a word game
#23SPOILER
view-source gives away the answer for the next 20 days....
Re: Show HN: My 70 year old grandma is learning to code and made a word game
#24[flagged]
spoiler warning! don't look at the source if you're going to play the game because the number of possible valid words is short
Re: Show HN: My 70 year old grandma is learning to code and made a word game
#25Earlier quoted context omitted.
Is it always the same word? My word is between Vodka and Vomit :D
It’s like wordle: different word every day and everyone gets it. At least that’s what the text says once you get it.
At least for the next 13 days, when gma will learn about null pointers
Re: Show HN: My 70 year old grandma is learning to code and made a word game
#26Great game! I would love a hint function though, as I honestly got stuck.
Or even a "give up" button because I'm definitely stumped
Re: Show HN: My 70 year old grandma is learning to code and made a word game
#27This game is somehow so compelling
Re: Show HN: My 70 year old grandma is learning to code and made a word game
#28Re: Show HN: My 70 year old grandma is learning to code and made a word game
#29Re: Show HN: My 70 year old grandma is learning to code and made a word game
#30[flagged]
I don’t understand why any of that indicates that a 70 year old couldn’t have created this, unless you think 70 year old people aren’t capable of doing that.