Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

rooms state

Back to all declarations

dirNames

map[string]int

Plain-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.

Open
OID
01958e…25b4:4
dirNames details

Inspect map

Compile

func(text string, max int) string

Compile 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.

Open
OID
01958e…25b4:7
Compile details

Inspect func

appendTicks

func(out []uint8, dir int, n string, step string) []uint8
Open
OID
01958e…25b4:9
appendTicks details

Inspect func

MinRoundTicks

untyped bigint

// 5 s

Value

(50 <untyped> bigint)

MaxRoundTicks

untyped bigint

// 15 s

Value

(150 <untyped> bigint)

MinSeconds

untyped bigint

// shortest room match

Value

(60 <untyped> bigint)

MaxSeconds

untyped bigint

// longest room match

Value

(300 <untyped> bigint)

PhaseBlocks

untyped bigint

Value

(30 <untyped> bigint)

MaxThought

untyped bigint

Value

(140 <untyped> bigint)

MaxName

untyped bigint

Value

(20 <untyped> bigint)

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)

Player

type

A Player is one side of a room.

Value

rooms.Player

Room

type

A Room is one live match.

Value

rooms.Room

rooms

v0.Tree

// zero-padded id -> \*Room

Open
OID
01958e…25b4:13
rooms details

Inspect ref

nextID

int

Value

3

mustRoom

func(id int) *rooms.Room
Open
OID
01958e…25b4:17
mustRoom details

Inspect func

cleanText

func(s string, max int, what string) string
Open
OID
01958e…25b4:19
cleanText details

Inspect func

MyBot

untyped bigint

MyBot 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)
Open
OID
01958e…25b4:20
checkPlayer details

Inspect func

fallbackBot

func(p *rooms.Player, seed uint32) string

fallbackBot 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.

Open
OID
01958e…25b4:21
fallbackBot details

Inspect func

Create

func(name string, class int, fallback int, roundTicks int, seconds int) int

Create opens a room. roundTicks is the round length in ticks (10 a second, 50 to 150, so 5 to 15 seconds; 100 is a good default). seconds is the whole match (60 to 300; 180 is a good default). fallback is the bot (0 easy, 1 normal, 2 hard, 3 the bot you saved in mybots) that plays for you in any round you miss. Returns the room id.

Open
OID
01958e…25b4:22
Create details

Inspect func

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.

Open
OID
01958e…25b4:23
Join details

Inspect func

side

func(r *rooms.Room, addr .uverse.address) int
Open
OID
01958e…25b4:24
side details

Inspect func

PlanHash

func(plan string, salt string) string

PlanHash is the fingerprint to seal: hex sha256 of plan + "|" + salt. Read it for free (vm/qeval) before sealing, or compute it yourself.

Open
OID
01958e…25b4:25
PlanHash details

Inspect func

Seal

func(id int, hash string)

Seal sends the fingerprint of your plan for this round.

Open
OID
01958e…25b4:26
Seal details

Inspect func

Reveal

func(id int, plan string, salt string, thought string)

Reveal sends your plan for this round: one input character per tick (see the brawl package; shorter means standing still for the rest), the salt you sealed it with, and a thought of up to 140 characters that everyone watching will see.

Open
OID
01958e…25b4:27
Reveal details

Inspect func

Advance

func(id int)

Advance moves a room on once its phase deadline has passed: whoever hasn't sealed or revealed is played by their fallback bot this round. Anyone may call it.

Open
OID
01958e…25b4:28
Advance details

Inspect func

play

func(r *rooms.Room)

play runs one round. A player without a revealed plan is played by their bot.

Open
OID
01958e…25b4:29
play details

Inspect func

StateJSON

func(id int) string

StateJSON is everything a player needs to plan the next round: the clock, both fighters, and where the coins and power-ups are (square = y\*15 + x).

Open
OID
01958e…25b4:30
StateJSON details

Inspect func

playerJSON

func(p *rooms.Player, g *brawl.Game, s int) string
Open
OID
01958e…25b4:31
playerJSON details

Inspect func

InputsJSON

func(id int) string

InputsJSON gives both players' inputs so far, to replay the match exactly with the brawl rules (side B is not turned round: both played live).

Open
OID
01958e…25b4:32
InputsJSON details

Inspect func

Open

func() string

Open lists rooms waiting for a second player, newest first, as JSON.

Open
OID
01958e…25b4:33
Open details

Inspect func

RoomCount

func() int

RoomCount is the number of rooms ever created.

Open
OID
01958e…25b4:34
RoomCount details

Inspect func
dirNames : map[string]int Inspect
buttons : map[string]int Inspect
Compile : func(text string, max int) string Inspect
appendTicks : func(out []uint8, dir int, n string, step string) []uint8 Inspect
MinRoundTicks : untyped bigint =(50 <untyped> bigint)
MaxRoundTicks : untyped bigint =(150 <untyped> bigint)
MinSeconds : untyped bigint =(60 <untyped> bigint)
MaxSeconds : untyped bigint =(300 <untyped> bigint)
PhaseBlocks : untyped bigint =(30 <untyped> bigint)
MaxThought : untyped bigint =(140 <untyped> bigint)
MaxName : untyped bigint =(20 <untyped> bigint)
Waiting : untyped bigint =(0 <untyped> bigint)
Sealing : untyped bigint =(1 <untyped> bigint)
Revealing : untyped bigint =(2 <untyped> bigint)
Done : untyped bigint =(3 <untyped> bigint)
phaseNames : [4]string Inspect
Player : type =rooms.Player
Room : type =rooms.Room
rooms : v0.Tree Inspect
nextID : int =3
key : func(id int) string Inspect
mustRoom : func(id int) *rooms.Room Inspect
height : func() int64 Inspect
cleanText : func(s string, max int, what string) string Inspect
MyBot : untyped bigint =(3 <untyped> bigint)
checkPlayer : func(class int, fallback int, addr .uverse.address) Inspect
fallbackBot : func(p *rooms.Player, seed uint32) string Inspect
Create : func(name string, class int, fallback int, roundTicks int, seconds int) int Inspect
Join : func(id int, name string, class int, fallback int) Inspect
side : func(r *rooms.Room, addr .uverse.address) int Inspect
PlanHash : func(plan string, salt string) string Inspect
Seal : func(id int, hash string) Inspect
Reveal : func(id int, plan string, salt string, thought string) Inspect
Advance : func(id int) Inspect
play : func(r *rooms.Room) Inspect
StateJSON : func(id int) string Inspect
playerJSON : func(p *rooms.Player, g *brawl.Game, s int) string Inspect
InputsJSON : func(id int) string Inspect
Open : func() string Inspect
RoomCount : func() int Inspect