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 bigintValue
(60 <untyped> bigint)
MaxSeconds
untyped bigintValue
(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 bigintValue
(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)
phaseNames
[5]string- OID
- 08ee79…afa0:4
phaseNames details
Player
typeA Player is one side of a match.
Value
v1.Player
Match
typeA Match is one real-time fight.
Value
v1.Match
matches
v0.Tree// zero-padded id -> \*Match
- OID
- 08ee79…afa0:6
matches details
nextID
intValue
2
key
func(id int) string- OID
- 08ee79…afa0:8
key details
height
func() int64- OID
- 08ee79…afa0:10
height details
mustMatch
func(id int) *v1.Match- OID
- 08ee79…afa0:11
mustMatch details
cleanName
func(s string) string- OID
- 08ee79…afa0:12
cleanName details
checkClass
func(class int)- OID
- 08ee79…afa0:13
checkClass details
Create
func(name string, class int, seconds int) intCreate opens a match of the given length (60 to 180 seconds, in tens) and takes side A.
- OID
- 08ee79…afa0:14
Create details
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.
- OID
- 08ee79…afa0:15
Join details
side
func(m *v1.Match, addr .uverse.address) int- OID
- 08ee79…afa0:16
side details
AnchorHash
func(prev string, chunk string) stringAnchorHash 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.
- OID
- 08ee79…afa0:17
AnchorHash details
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.
- OID
- 08ee79…afa0:18
Anchor details
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.
- OID
- 08ee79…afa0:19
Submit details
replay
func(m *v1.Match)replay plays both logs against each other on the brawl rules.
- OID
- 08ee79…afa0:20
replay details
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.
- OID
- 08ee79…afa0:21
Settle details
MatchCount
func() int- OID
- 08ee79…afa0:22
MatchCount details
Inputs
func(id int, side int) stringInputs is one side's submitted log ("" until it is in).
- OID
- 08ee79…afa0:23
Inputs details
Anchors
func(id int, side int) stringAnchors lists a side's anchors so far, joined by commas.
- OID
- 08ee79…afa0:24
Anchors details
StateJSON
func(id int) stringStateJSON describes a match for the programs and the browser.
- OID
- 08ee79…afa0:25
StateJSON details
Render
func(path string) stringRender draws the match list for gnoweb.
- OID
- 08ee79…afa0:26