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
BracketCityPuzzle.BracketBracketCityPuzzle.all_bracketsBracketCityPuzzle.findBracketBracketCityPuzzle.hasanswerBracketCityPuzzle.issolvedBracketCityPuzzle.parse_puzzleBracketCityPuzzle.preduceBracketCityPuzzle.set_answerBracketCityPuzzle.show_puzzleBracketCityPuzzle.to_stringBracketCityPuzzle.tokenize_puzzleBracketCityPuzzle.walkBrackets
Definitions
BracketCityPuzzle.Bracket — Type
Bracket(clue, answer)Represents a bracketed clue, and possibly its answer.
BracketCityPuzzle.all_brackets — Method
all_brackets(parsed::BCPuzzle)Returns a vector of all of the Brackets within parsed.
BracketCityPuzzle.findBracket — Function
findBracket(test, ::BCPuzzle)::Vector{Bracket}Returns a vector of Bracket objects that match test, which can be a predicate or a substring to match.
BracketCityPuzzle.hasanswer — Method
hasanswer(::Bracket)Returns true if the Bracket has an answer.
BracketCityPuzzle.issolved — Method
issolved(::PuzzleElement)::BoolReturns true if the puzzle element is solved.
A Bracket is solved only if it and all descendents are solved.
BracketCityPuzzle.parse_puzzle — Function
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.
BracketCityPuzzle.preduce — Function
preduce(::BCPuzzle)::BCPuzzleSimplifies the puzzle to a new puzzle by substituting in any Bracket answers that are known.
BracketCityPuzzle.set_answer — Method
set_answer(parsed::BCPuzzle, bracket_id::Int, answer::AbstractString)Find the Bracket with the specified bracket_id and set its answer to answer.
BracketCityPuzzle.show_puzzle — Method
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.
BracketCityPuzzle.to_string — Function
to_string(puzzle::BCPuzzle)::AbstractStringConvert the puzzle to its textual representation. This is the inverse of parse_puzzle.
BracketCityPuzzle.tokenize_puzzle — Method
tokenize_puzzle(::AbstractString)Tokenizes the string to produce a Vector of tokens consisting of strings, :openbracket and :closebracket symbols.
BracketCityPuzzle.walkBrackets — Method
walkBrackets(f::Function, thing)Calls the function on eqch Bracket nested within thing.
My Score Graph
A graph comparing my solved puzzle scores with tose of the entire Bracket City community can be found
here .