22 Matching Annotations
  1. Jul 2023
    1. ```python from flask import Flask, request from collections import defaultdict import re import random

      GREEN ="🟩" YELLOW ="🟨" WHITE ="⬜"

      def get_answers(): with open("allowed_answers.txt") as f: answers = set(l for l in f.read().splitlines() if l) return answers

      def get_guesses(): guesses = get_answers() with open("allowed_guesses.txt") as f: for l in f.read().splitlines(): if l: guesses.add(l) return guesses

      app = Flask(name, static_folder="static") app.answers = get_answers() app.guesses = get_guesses() word = random.choice(list(app.answers)) print(f"The word is {word}")

      def with_header(content): return f"""

      <html> <head> <link rel="search" type="application/opensearchdescription+xml" title="searchGame" href="http://searchgame:5000/static/opensearch.xml" /> </head> <body> {content} </body></html>


      @app.route("/") def home(): return with_header("

      Right click on the address bar to install the search engine.


      @app.route("/search") def search(): return with_header(f"Content: {request.args.get('q')}")

      def to_result(guess, answer): chars = [WHITE] * 5 count = defaultdict(int) for idx, (g, a) in enumerate(zip(guess, answer)): if g == a: chars[idx] = GREEN else: count[a] += 1

      for idx, g in enumerate(guess):
          if g in count and count[g] > 0 and chars[idx] == WHITE:
              chars[idx] = YELLOW
              count[g] -= 1
      return "".join(chars)

      def maybe_error(guess): if len(guess) < 5: return f"less than 5 characters" if len(guess) > 5: return f"greater than 5 characters" if guess not in app.guesses: return f"not in wordlist" return None

      @app.route("/game") def game(): query = request.args.get("q") guesses = [x for x in re.split("[. ]", query) if x] response = [] if not guesses: response.append("Enter 5-letter guesses separated by spaces") else: most_recent = guesses[-1] # Don't show "too short" error for most recent guess if len(most_recent) < 5: guesses = guesses[:-1] if not guesses: response.append("Enter a wordle guess") for guess in guesses[::-1]: error = maybe_error(guess) if error is None: result = to_result(guess, word) s = f"{guess} | {result}" if result == GREEN * 5: s = f"{s} | CORRECT!" response.append(s) else: response.append(f"{guess} | ERROR: {error}")

      return [query, response]


  2. May 2023
  3. Feb 2022
    1. bash $ host -t txt wd.ip.wtf wd.ip.wtf descriptive text "Welcome to Wordle over DNS! Today's puzzle is #1: <guess>.1.wd.ip.wtf" wd.ip.wtf descriptive text "This shell function makes it easier to play" "wd() { dig +short txt $1.1.wd.ip.wtf | perl -pe's/\\\([0-9]{1,3})/chr$1/eg'; }"

      bash $ wd() { dig +short txt $1.example.wd.ip.wtf | perl -pe's/\\\([0-9]{1,3})/chr$1/eg'; } $ wd crane "⬜⬜🟨🟨🟨" $ wd reads "⬜🟨🟨⬜🟩" $ wd sense "🟨🟨🟨⬜⬜" $ wd names "🟩🟩🟩🟩🟩"

  4. Jan 2022
    1. https://english.elpais.com/science-tech/2022-01-14/a-spanish-data-scientists-strategy-to-win-99-of-the-time-at-wordle.html

      Story of a scientist trying to optimize for solutions of Wordle.

      Nothing brilliant here. Depressing that the story creates a mythology around algorithms as the solution rather than delving in a bit into the math and science of information theory to explain why this solution is the correct one.

      Desperately missing from the discussion are second and third order words that would make useful guesses to further reduce the solution space for actual readers.

    2. The letters of “aeros” include the five most frequent letters used in English (as Edgar Allan Poe pointed out in the cryptographic challenge included in his famous short story The Golden Beetle)

      "Orate" and "aeros" are respectively the best words to start with when playing Wordle.

    3. Cross-referencing the correct answers from previous Wordles with a body of the most commonly used English terms, Moro confirmed that Wardle chooses frequently used words in English, something the game’s inventor also pointed out in his interview with The New York Times, which mentioned that he avoided rare words.

      Wordle specifically chooses more common words which cuts back drastically on the complexity of the game.

    4. The inventor of the original English version, Welsh-born software engineer Josh Wardle, created it during the pandemic to entertain his partner – a word game addict, as he told The New York Times.