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.

v1 state

Back to all declarations

AnchorTicks

untyped bigint

// ticks between anchors (10 s)

Value

(100 <untyped> bigint)

AnchorBlocks

untyped bigint

// blocks that must pass per anchor (testnet blocks are about 4 s)

Value

(2 <untyped> bigint)

MinSeconds

untyped bigint

Value

(60 <untyped> bigint)

MaxSeconds

untyped bigint

Value

(180 <untyped> bigint)

AnchorSlack

untyped bigint

// blocks an anchor may land after its time (about 40 s)

Value

(10 <untyped> bigint)

Grace

untyped bigint

// blocks after the last anchor window, to submit

Value

(150 <untyped> bigint)

MaxName

untyped bigint

Value

(20 <untyped> bigint)

Waiting

untyped bigint

// created, waiting for a second player

Value

(0 <untyped> bigint)

Playing

untyped bigint

// being played off-chain; anchors arrive

Value

(1 <untyped> bigint)

Done

untyped bigint

// both logs replayed, score recorded

Value

(2 <untyped> bigint)

Forfeit

untyped bigint

// a side did not deliver; see Winner

Value

(3 <untyped> bigint)

Void

untyped bigint

// neither side delivered

Value

(4 <untyped> bigint)

Player

type

A Player is one side of a match.

Value

v1.Player

Match

type

A Match is one real-time fight.

Value

v1.Match

matches

v0.Tree

// zero-padded id -> \*Match

Open
OID
08ee79…afa0:6
matches details

Inspect ref

nextID

int

Value

2

mustMatch

func(id int) *v1.Match
Open
OID
08ee79…afa0:11
mustMatch details

Inspect func

cleanName

func(s string) string
Open
OID
08ee79…afa0:12
cleanName details

Inspect func

Create

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

Create opens a match of the given length (60 to 180 seconds, in tens) and takes side A.

Open
OID
08ee79…afa0:14
Create details

Inspect func

Join

func(id int, name string, class int)

Join takes side B and starts the match. The arena and coins come from the block it starts in; both programs read Seed and start playing from tick 0.

Open
OID
08ee79…afa0:15
Join details

Inspect func

side

func(m *v1.Match, addr .uverse.address) int
Open
OID
08ee79…afa0:16
side details

Inspect func

AnchorHash

func(prev string, chunk string) string

AnchorHash is the anchor for a chunk of inputs: hex sha256 of the previous anchor ("" for the first), a "|", and the next 100 inputs. Anchor k covers every input up to tick 100\*k, so each anchor commits to the whole log.

Open
OID
08ee79…afa0:17
AnchorHash details

Inspect func

Anchor

func(id int, hash string)

Anchor sends your next hash. Anchor k must land in the window from block start + 2k to start + 2k + AnchorSlack: not earlier, so you cannot commit a whole match in advance, and not later, so you cannot wait to see the rival's moves before committing yours. An anchor that misses its window can never be sent, and the match is then forfeit.

Open
OID
08ee79…afa0:18
Anchor details

Inspect func

Submit

func(id int, inputs string)

Submit sends your full input log: one character per tick (see the brawl package's Encode). It must hash to every anchor you sent. When both logs are in, the chain replays them and records the score.

Open
OID
08ee79…afa0:19
Submit details

Inspect func

replay

func(m *v1.Match)

replay plays both logs against each other on the brawl rules.

Open
OID
08ee79…afa0:20
replay details

Inspect func

Settle

func(id int)

Settle closes a match whose deadline has passed. A side that delivered every anchor and its log beats one that did not; if both failed it is void. Anyone can call it.

Open
OID
08ee79…afa0:21
Settle details

Inspect func

Inputs

func(id int, side int) string

Inputs is one side's submitted log ("" until it is in).

Open
OID
08ee79…afa0:23
Inputs details

Inspect func

Anchors

func(id int, side int) string

Anchors lists a side's anchors so far, joined by commas.

Open
OID
08ee79…afa0:24
Anchors details

Inspect func

StateJSON

func(id int) string

StateJSON describes a match for the programs and the browser.

Open
OID
08ee79…afa0:25
StateJSON details

Inspect func

Render

func(path string) string

Render draws the match list for gnoweb.

Open
OID
08ee79…afa0:26
Render details

Inspect func
AnchorTicks : untyped bigint =(100 <untyped> bigint)
AnchorBlocks : untyped bigint =(2 <untyped> bigint)
MinSeconds : untyped bigint =(60 <untyped> bigint)
MaxSeconds : untyped bigint =(180 <untyped> bigint)
AnchorSlack : untyped bigint =(10 <untyped> bigint)
Grace : untyped bigint =(150 <untyped> bigint)
MaxName : untyped bigint =(20 <untyped> bigint)
Waiting : untyped bigint =(0 <untyped> bigint)
Playing : untyped bigint =(1 <untyped> bigint)
Done : untyped bigint =(2 <untyped> bigint)
Forfeit : untyped bigint =(3 <untyped> bigint)
Void : untyped bigint =(4 <untyped> bigint)
phaseNames : [5]string Inspect
Player : type =v1.Player
Match : type =v1.Match
matches : v0.Tree Inspect
nextID : int =2
key : func(id int) string Inspect
height : func() int64 Inspect
mustMatch : func(id int) *v1.Match Inspect
cleanName : func(s string) string Inspect
checkClass : func(class int) Inspect
Create : func(name string, class int, seconds int) int Inspect
Join : func(id int, name string, class int) Inspect
side : func(m *v1.Match, addr .uverse.address) int Inspect
AnchorHash : func(prev string, chunk string) string Inspect
Anchor : func(id int, hash string) Inspect
Submit : func(id int, inputs string) Inspect
replay : func(m *v1.Match) Inspect
Settle : func(id int) Inspect
MatchCount : func() int Inspect
Inputs : func(id int, side int) string Inspect
Anchors : func(id int, side int) string Inspect
StateJSON : func(id int) string Inspect
Render : func(path string) string Inspect