Comment

Comment by susam

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, 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!
parent susam 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton