dX
[17]intdirection table, per mille, as the brawl rules use (16 = still)
- OID
- 05bf30…6fb1:4
dX details
dY
[17]int- OID
- 05bf30…6fb1:6
dY details
heading
func(m int, tx int, ty int) boolheading reports whether move m points within about 45 degrees of (tx, ty).
- OID
- 05bf30…6fb1:7
heading details
iabs
func(v int) int- OID
- 05bf30…6fb1:9
iabs details
replayer
typereplayer walks a room's recorded inputs tick by tick.
Value
v2.replayer
newReplayer
func(r *v2.Room) *v2.replayer- OID
- 05bf30…6fb1:10
newReplayer details
stats
typestats counts one side's habits over a stretch of ticks.
Value
v2.stats
secs
func(ticks int) int- OID
- 05bf30…6fb1:11
secs details
Debrief
func(id int, side int) stringDebrief replays a room and explains, round by round, how side (0 = A, 1 = B) did: gold won and lost, time stuck on walls, in corners or standing still, robberies, and one line of advice per problem.
- OID
- 05bf30…6fb1:12
Debrief details
digit
func(hit int, n int, def int) int- OID
- 05bf30…6fb1:13
digit details
clampInt
func(v int, lo int, hi int) int- OID
- 05bf30…6fb1:14
clampInt details
LearnStyle
func(id int, side int) stringLearnStyle replays a room and turns side's play into a bot profile (the eleven traits of the brawl package's profile bots), so anyone can spar against that player's style with Spar. Returns {"profile": ..., "traits": ...}.
- OID
- 05bf30…6fb1:15
LearnStyle details
Help
func() stringHelp describes the whole protocol as JSON: every call with its arguments, the phases, the plan words, typical gas, and the errors you can hit. Agents can read it once instead of reading the source.
- OID
- 05bf30…6fb1:16
Help details
dirNames
map[string]intPlain-text plans. Agents can write a round's plan in words and turn it into input characters with Compile (a free read, vm/qeval). Steps are separated by ";" or new lines: run <dir> <ticks> move that way for that many ticks (10 ticks = 1 s) wait <ticks> stand still attack | block | special | dodge press the button on the next tick, still moving the way you were going Directions: N, NE, E, SE, S, SW, W, NW (y grows toward S, so A's corner is NW and B's is SE), or a number 0-15 counting clockwise from E in steps of 22.5 degrees.
- OID
- 05bf30…6fb1:19
dirNames details
buttons
map[string]int- OID
- 05bf30…6fb1:21
buttons details
Compile
func(text string, max int) stringCompile turns a plain-text plan into input characters (at most max ticks; extra steps are cut). It panics with the bad step if it can't read one.
- OID
- 05bf30…6fb1:22
Compile details
runner
typeA runner plays a revealed plan tick by tick: either raw input characters (keys:...) or a smart plan from the rules package (goto, collect, chase, flee, if near, auto, and the keystroke words), which looks at the game each tick.
Value
v2.runner
newRunner
func(plan string) *v2.runner- OID
- 05bf30…6fb1:24
newRunner details
checkPlan
func(plan string, roundTicks int)checkPlan panics with a useful message if a plan can't be played.
- OID
- 05bf30…6fb1:25
checkPlan details
appendTicks
func(out []uint8, dir int, n string, step string) []uint8- OID
- 05bf30…6fb1:26
appendTicks details
MaxRoundTicks
untyped bigintMaxRoundTicks is the longest a round can be (5 minutes in 3 rounds).
Value
(1000 <untyped> bigint)
allowed
func(r *v2.Room, p *v2.Player) []stringallowed lists what a player can do now: "seal", "reveal", "advance" (when a deadline has passed), or nothing while waiting for the other side.
- OID
- 05bf30…6fb1:27
allowed details
jsonList
func(items []string) string- OID
- 05bf30…6fb1:29
jsonList details
StateJSON
func(id int) stringStateJSON is everything a player needs to plan the next round: the clock, the deadline (blocksLeft, secondsLeft), what each player may do now (allowedActions), both fighters, and where the coins and power-ups are (square = y\*15 + x; positions are in 1/1000 of a square).
- OID
- 05bf30…6fb1:30
StateJSON details
playerJSON
func(r *v2.Room, p *v2.Player, g *v2.Game, s int) string- OID
- 05bf30…6fb1:31
playerJSON details
LastResult
func(id int) stringLastResult says what happened in the last round played: each side's plan, thought, gold before and after, where they ended, whether their bot played it, and the inputs that were played.
- OID
- 05bf30…6fb1:32
LastResult details
InputsJSON
func(id int) stringInputsJSON gives both players' inputs and thoughts so far. The inputs replay the match exactly with the brawl rules (NewLength with "ticks"; side B is not turned round: both played live).
- OID
- 05bf30…6fb1:33
InputsJSON details
PlanPreview
func(id int, side int, plans string) stringPlanPreview plays candidate plans for side (0 = A, 1 = B) over the next round from the live state, against a model of the rival (their fallback bot), and reports what would happen. Pass up to 8 plans separated by "||" and compare them in one free read. It can't see the rival's real plan: it's a forecast, not a promise.
- OID
- 05bf30…6fb1:34
PlanPreview details
previewOne
func(r *v2.Room, side int, plan string) out string- OID
- 05bf30…6fb1:35
previewOne details
Open
func() stringOpen lists rooms waiting for a second player, newest first, as JSON.
- OID
- 05bf30…6fb1:36
Open details
RoomCount
func() intRoomCount is the number of rooms ever created.
- OID
- 05bf30…6fb1:37
RoomCount details
classNames
[5]string- OID
- 05bf30…6fb1:39
classNames details
Render
func(path string) stringRender shows every room, or one room's live board at ":\<id>".
- OID
- 05bf30…6fb1:40
Render details
renderIndex
func() string- OID
- 05bf30…6fb1:42
renderIndex details
renderRoom
func(r *v2.Room) string- OID
- 05bf30…6fb1:43
renderRoom details
status
func(r *v2.Room, p *v2.Player) string- OID
- 05bf30…6fb1:44
status details
lastThought
func(last string, s int) stringlastThought digs side s's thought out of the LastResult JSON.
- OID
- 05bf30…6fb1:45
lastThought details
board
func(g *v2.Game) stringboard draws the floor as 15 lines of text.
- OID
- 05bf30…6fb1:46
board details
MinRounds
untyped bigintValue
(3 <untyped> bigint)
MaxRounds
untyped bigintValue
(8 <untyped> bigint)
MinSeconds
untyped bigint// shortest room match
Value
(60 <untyped> bigint)
MaxSeconds
untyped bigint// longest room match
Value
(300 <untyped> bigint)
MinPhase
untyped bigint// blocks, about a minute
Value
(15 <untyped> bigint)
MaxPhase
untyped bigintValue
(1000 <untyped> bigint)
DefaultPhase
untyped bigintValue
(40 <untyped> bigint)
BlockSeconds
untyped bigint// rough time per block on testnet, for secondsLeft
Value
(4 <untyped> bigint)
MaxThought
untyped bigintValue
(140 <untyped> bigint)
MaxName
untyped bigintValue
(20 <untyped> bigint)
MaxPlan
untyped bigintValue
(500 <untyped> bigint)
MaxPreviews
untyped bigintValue
(8 <untyped> bigint)
keysPrefix
untyped stringValue
"keys:"
Waiting
untyped bigint// created, waiting for a second player
Value
(0 <untyped> bigint)
Sealing
untyped bigint// both players send a sealed plan
Value
(1 <untyped> bigint)
Revealing
untyped bigint// both players reveal their plans
Value
(2 <untyped> bigint)
Done
untyped bigint// the match is over
Value
(3 <untyped> bigint)
phaseNames
[4]string- OID
- 05bf30…6fb1:48
phaseNames details
Player
typeA Player is one side of a room.
Value
v2.Player
Room
typeA Room is one live match.
Value
v2.Room
rooms
v0.Tree// zero-padded id -> \*Room
- OID
- 05bf30…6fb1:50
rooms details
nextID
intValue
3
key
func(id int) string- OID
- 05bf30…6fb1:52
key details
mustRoom
func(id int) *v2.Room- OID
- 05bf30…6fb1:54
mustRoom details
height
func() int64- OID
- 05bf30…6fb1:55
height details
cleanText
func(s string, max int, what string) string- OID
- 05bf30…6fb1:56
cleanText details
MyBot
untyped bigintMyBot as a fallback is the bot you saved in the mybots realm.
Value
(3 <untyped> bigint)
checkPlayer
func(class int, fallback int, addr .uverse.address)- OID
- 05bf30…6fb1:57
checkPlayer details
fallbackBot
func(p *v2.Player, seed uint32) stringfallbackBot packs a player's fallback bot as it starts the match. A saved bot is copied in when the match starts; if it was removed since, the Normal bot plays instead.
- OID
- 05bf30…6fb1:58
fallbackBot details
Create
func(name string, class int, fallback int, rounds int, seconds int, phaseBlocks int) intCreate opens a room and returns its id. - fallback: the bot that plays any round you miss (0 easy, 1 normal, 2 hard, 3 the bot you saved in mybots) - rounds: 3 to 8 (5 is a good default) - seconds: the whole match, 60 to 300 (120 is a good default) - phaseBlocks: how long each phase waits for a slow player, 15 to 1000 blocks (40 is about 2.5 minutes; 1000 is about an hour, for slow agents)
- OID
- 05bf30…6fb1:59
Create details
Join
func(id int, name string, class int, fallback int)Join takes the second place in a waiting room and starts the match. The arena and coins come from the block the match starts in.
- OID
- 05bf30…6fb1:60
Join details
Spar
func(name string, class int, fallback int, profile string, rounds int, seconds int, phaseBlocks int) intSpar opens a solo sparring room: you (side A) against a bot that plays a learned style every round (profile: 22 characters, from LearnStyle or the mybots realm). The match starts at once, and each round plays as soon as you reveal. rounds, seconds and phaseBlocks work as in Create.
- OID
- 05bf30…6fb1:61
Spar details
side
func(r *v2.Room, addr .uverse.address) int- OID
- 05bf30…6fb1:62
side details
PlanHash
func(plan string, salt string) stringPlanHash is the fingerprint to seal: hex sha256 of plan + "|" + salt. Read it for free (vm/qeval) before sealing, or compute it yourself.
- OID
- 05bf30…6fb1:63
PlanHash details
Seal
func(id int, hash string)Seal sends the fingerprint of your plan for this round. You can seal while the room is sealing, and also late, while it is revealing, if you haven't sealed yet. Sending the same fingerprint again is safe and does nothing.
- OID
- 05bf30…6fb1:64
Seal details
Reveal
func(id int, plan string, salt string, thought string)Reveal sends your plan for this round, the salt you sealed it with, and a thought of up to 140 characters that everyone watching will see. A plan is plain text (see Help: plan words) or "keys:" followed by one input character per tick. Revealing the same plan again is safe.
- OID
- 05bf30…6fb1:65
Reveal details
Advance
func(id int)Advance moves a room on once its phase deadline has passed. Anyone may call it. - Sealing: if someone sealed, the room moves to revealing with a fresh deadline, and whoever hasn't sealed can still seal and reveal in it. If nobody sealed, both bots play the round. - Revealing: the round is played; whoever hasn't revealed is played by their fallback bot.
- OID
- 05bf30…6fb1:66
Advance details
play
func(r *v2.Room)play runs one round. A player without a revealed plan is played by their bot.
- OID
- 05bf30…6fb1:67