time to LLM a binary search 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…
Classic LLM hijinks or hacker goofing off on HN? Either might throw `exec('\n'.join(lines))` in a script running on a publicly downloaded file rather than parsing it more directly.
Show HN: My 70 year old grandma is learning to code and made a word game
81–90 of 160 posts
Re: Show HN: My 70 year old grandma is learning to code and made a word game
#82There is some bug in the sorting, because it sorted “vol” after “volatile” for me. It seems to depend on some previous state, though, because I couldn’t reproduce it in a new window. Edit: See also https://news.ycombinator.com/item?id=41217457 .
Re: Show HN: My 70 year old grandma is learning to code and made a word game
#83Re: Show HN: My 70 year old grandma is learning to code and made a word game
#84Re: Show HN: My 70 year old grandma is learning to code and made a word game
#85time to LLM a binary search 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…
So you didn't want to have fun playing the game, but also didn't want to have fun coding a solver? I understand the former, but not the latter... :D
Re: Show HN: My 70 year old grandma is learning to code and made a word game
#86That is cool - it is nice and simple, but fun. The code is clearly from a beginner, but the saved game bit shows that she is a clever beginner - such a pragmatic way to continue a game. I hope she keeps learning and building more.
Re: Show HN: My 70 year old grandma is learning to code and made a word game
#87Earlier 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
you are being just as rude as the other person, if not more, buddy. There is a much better and constructive way to make this point. Also, the title says that she is "learning to code" so its not unreasonable to say that she probably isn't handling the website stuff... Also, the commenter is making a conjecture about the veracity of OP, not the mother per se.
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?"
Re: Show HN: My 70 year old grandma is learning to code and made a word game
#88Re: Show HN: My 70 year old grandma is learning to code and made a word game
#89Earlier quoted context omitted.
So you didn't want to have fun playing the game, but also didn't want to have fun coding a solver? I understand the former, but not the latter... :D
Going from knowing exactly what I want, to it materializing from just from a 60 second conversation in the sidebar of my browser, does give me a bit of a buzz
Re: Show HN: My 70 year old grandma is learning to code and made a word game
#90Arriving 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!