BracketCityPuzzle

Documentation for BracketCityPuzzle.

These are some software tools for working with "Bracket City" puzzles as appear onnthe web site for The Atlantic Monthly.

Example

Here's an example that illustrates how this software can be helpful for back-solving some clues:

using BracketCityPuzzle

# Puzzle from 2025-09-29:
parsed = parse_puzzle("""\"Willie ["to whom it  c[first word in many
 [decadent break[⏩ ( [where you want to put your [the B in BFF] foot])]
location]time stories]rn"]s makes "The [phrase ("y[Swedish pop
group behind "Mamma Mia"] dabba doo!" or "to [concept represented
 by a sideways [lucky number in 🇨🇳 (add [star count for a very
 fancy [The Plaza or The [disc-shaped [ a joke/smile/window]er
 with a finely s[☎️ conference ➡️  ⬅️ "of [heavy- (designed
 for durability)]" 🪖]oped edge], e.g.]] to get an unlucky number
 in 🇺🇸)]] and beyond!" 🚀, e.g.)]\"""")

show_puzzle(parsed)
"Willie
[1
  "to whom it  c
  [2
    first word in many

    [3
      decadent break
      [4
        ⏩ (
        [5
          where you want to put your
          [6
            the B in BFF
          ]
           foot
        ]
        )
      ]

location
    ]
    time stories
  ]
  rn"
]
s makes "The
[7
  phrase ("y
  [8
    Swedish pop
group behind "Mamma Mia"
  ]
   dabba doo!" or "to
  [9
    concept represented
 by a sideways
    [10
      lucky number in 🇨🇳 (add
      [11
        star count for a very
 fancy
        [12
          The Plaza or The
          [13
            disc-shaped
            [14
               a joke/smile/window
            ]
            er
 with a finely s
            [15
              ☎️ conference ➡️  ⬅️ "of
              [16
                heavy- (designed
 for durability)
              ]
              " 🪖
            ]
            oped edge
          ]
          , e.g.
        ]
      ]
       to get an unlucky number
 in 🇺🇸)
    ]
  ]
   and beyond!" 🚀, e.g.)
]
"

Unfortunately, the "blank" "___" characters are lost during the cut and paste of the puzzle text.

Above, I can now see the puzzle in an indented "outline" style that makes the nesting of the brackets obvious. Each bracket is identified with a unique number so we can indicate which clue is being answered. I can add those answers I can figure out:

set_answer(parsed, 6, "best")
set_answer(parsed, 5, "forward")
set_answer(parsed, 8, "abba")
set_answer(parsed, 14, "crack")
set_answer(parsed, 16, "duty")
set_answer(parsed, 15, "call")
set_answer(parsed, 13, "ritz")
set_answer(parsed, 12, "hotel")
set_answer(parsed, 11, "five")

show_puzzle(preduce(parsed))
"Willie
[1
  "to whom it  c
  [2
    first word in many

    [3
      decadent break
      [4
        ⏩ ( forward)
      ]

location
    ]
    time stories
  ]
  rn"
]
s makes "The
[7
  phrase ("yabba dabba doo!" or "to
  [9
    concept represented
 by a sideways
    [10
      lucky number in 🇨🇳 (add five to get an unlucky number
 in 🇺🇸)
    ]
  ]
   and beyond!" 🚀, e.g.)
]
"

Above, preduce is used so that fully solved bracket expressions are replaced with their answers.

At this point, I wasn't able too figure out any of the highlighted clues, but I was able to figure out several outer clues, so I answered those:

set_answer(parsed, 1, "may")           # to whom it may concern
set_answer(parsed, 2, "once")          # cONCErn
set_answer(parsed, 3, "bed")           # bedtime stories

show_puzzle(preduce(parsed))
"Willie
[1 may
  "to whom it  c
  [2 once
    first word in many

    [3 bed
      decadent break
      [4
        ⏩ ( forward)
      ]

location
    ]
    time stories
  ]
  rn"
]
s makes "The
[7
  phrase ("yabba dabba doo!" or "to
  [9
    concept represented
 by a sideways
    [10
      lucky number in 🇨🇳 (add five to get an unlucky number
 in 🇺🇸)
    ]
  ]
   and beyond!" 🚀, e.g.)
]
"

Once I had the context for the remaining clues, their answers were straightforward

set_answer(parsed, 4, "fast")
set_answer(parsed, 10, "eight")
set_answer(parsed, 9, "infinity")
set_answer(parsed, 7, "catch")
show_puzzle(preduce(parsed))
"Willie mays makes "The catch"

That is why I find this software helpful for solving Bracket City puzzles.

Index

Definitions

BracketCityPuzzle.findBracketFunction
findBracket(test, ::BCPuzzle)::Vector{Bracket}

Returns a vector of Bracket objects that match test, which can be a predicate or a substring to match.

source
BracketCityPuzzle.parse_puzzleFunction
parse_puzzle(string_or_token_vector)

Parses the string representation of a Bracket City puzzle. The result is a vector of strings and nested Bracket objects.

source
BracketCityPuzzle.set_answerMethod
set_answer(parsed::BCPuzzle, bracket_id::Int, answer::AbstractString)

Find the Bracket with the specified bracket_id and set its answer to answer.

source
BracketCityPuzzle.show_puzzleMethod
show_puzzle(parsed::BCPuzzle)

Outputs the puzzle in a more readable format with lines indented proportional to bracket nesting.

If a Bracket has an answer then it is printed immediately before the close braclet.

source
BracketCityPuzzle.tokenize_puzzleMethod
tokenize_puzzle(::AbstractString)

Tokenizes the string to produce a Vector of tokens consisting of strings, :openbracket and :closebracket symbols.

source

My Score Graph

A graph comparing my solved puzzle scores with tose of the entire Bracket City community can be found

here .