moveWindow
untyped bigint// seconds a player has for each move
Value
(86400 <untyped> bigint)
openWindow
untyped bigint// seconds an open challenge stays on the board
Value
(604800 <untyped> bigint)
maxBox
untyped bigint// bytes
Value
(104 <untyped> bigint)
maxPage
untyped bigintValue
(50 <untyped> bigint)
maxCleared
untyped bigint// expired challenges one Challenge deletes at most
Value
(8 <untyped> bigint)
idDigits
untyped bigintValue
(10 <untyped> bigint)
phaseOpen
untyped stringValue
"open"
phaseReveal
untyped stringValue
"reveal"
phasePlay
untyped stringValue
"play"
phaseEnded
untyped stringValue
"ended"
phaseExpired
untyped string// reported for an open match past its expiry, never stored
Value
"expired"
lastID
intValue
3
OpenChallenge
typeOpenChallenge is an open challenge as the board lists it.
Value
v0.OpenChallenge
Challenge
func(clan string, deckSeal string, planSeal string, box string, opponent .uverse.address) stringChallenge posts a challenge for clan with the seals of the challenger's deck and round-1 plan, the box holding both, and an opponent who alone may accept, or none. It returns the new match's id. It first deletes up to 8 expired challenges, whoever posted them.
- OID
- 030725…5ac0:4
Challenge details
Open
func(offset int, limit int) []v0.OpenChallengeOpen lists open, unexpired challenges, newest first: limit of them after skipping offset. limit is 1 to 50.
- OID
- 030725…5ac0:6
Open details
forget
func(id int, challenger .uverse.address)forget deletes open challenge id and its place among its challenger's matches. Its entry on the open list is the caller's to remove.
- OID
- 030725…5ac0:7
forget details
checkPage
func(offset int, limit int)- OID
- 030725…5ac0:8
checkPage details
boxBytes
func(text string) stringboxBytes decodes a box argument: the standard base64 of 1 to maxBox bytes, in the one form that encodes them, so Match returns every box exactly as it was sent.
- OID
- 030725…5ac0:9
boxBytes details
canonical
func(a .uverse.address) boolcanonical accepts a valid address in the lowercase form callers carry. bech32 also allows uppercase, which would never equal a caller's address.
- OID
- 030725…5ac0:10
canonical details
validSeal
func(s string) boolvalidSeal accepts a sha256 sum in lowercase hex.
- OID
- 030725…5ac0:11
validSeal details
chunkSize
untyped bigint// match ids per chunk
Value
(64 <untyped> bigint)
addressSize
untyped bigint// bytes in an address's text
Value
(40 <untyped> bigint)
sealSize
untyped bigint// bytes in a raw sha256 seal
Value
(32 <untyped> bigint)
lockSize
untyped bigintValue
(48 <untyped> bigint)
openSize
untyped bigintValue
(8 <untyped> bigint)
planBits
untyped bigint// bits per round in a side's plans: 2 for the length, 6 per card
Value
(20 <untyped> bigint)
cardBits
untyped bigintValue
(6 <untyped> bigint)
maxPlanLen
untyped bigintValue
(3 <untyped> bigint)
maxRound
untyped bigintValue
(3 <untyped> bigint)
maxPool
untyped bigint// cards in a clan's pool; a deck is one bit per pool card
Value
(16 <untyped> bigint)
bitsAt
func(v uint64, at uint, width uint) uint64bitsAt returns the width bits of v starting at bit at.
- OID
- 030725…5ac0:12
bitsAt details
withBits
func(v uint64, at uint, width uint, x uint64) uint64withBits returns v with the width bits at bit at replaced by x.
- OID
- 030725…5ac0:14
withBits details
mask
func(width uint) uint64- OID
- 030725…5ac0:15
mask details
planAt
func(plans uint64, round int) v0.PlanplanAt returns the plan made for round, or nil when it is not yet made.
- OID
- 030725…5ac0:16
planAt details
withPlan
func(plans uint64, round int, p v0.Plan) uint64withPlan returns plans with round's plan set to p.
- OID
- 030725…5ac0:17
withPlan details
plansMade
func(plans uint64) intplansMade counts the rounds from the first that have a plan.
- OID
- 030725…5ac0:18
plansMade details
planOffset
func(round int) uint- OID
- 030725…5ac0:19
planOffset details
deckOnPool
func(pool uint64, deck uint64) uint16deckOnPool returns deck, a set of card ids, as one bit per card of pool in id order.
- OID
- 030725…5ac0:20
deckOnPool details
deckFromPool
func(pool uint64, bits uint16) uint64deckFromPool is the inverse of deckOnPool.
- OID
- 030725…5ac0:21
deckFromPool details
cardsIn
func(pool uint64) uint- OID
- 030725…5ac0:22
cardsIn details
writer
typeValue
v0.writer
reader
typeValue
v0.reader
record
typerecord is a match as the arena works on it, decoded from its stored bytes. clans holds each side's index in the ruleset plus one, 0 for none; decks and plans are the engine's card sets and the packed plans of withPlan; hp is the HP after each round, per side; carried holds only the Vulnerable and Strength left after the last resolved round. deckSeal and seal are 64 hex characters; box is the raw bytes, up to maxBox, stored with a 2-byte length.
Value
v0.record
flagOpponent
untyped bigintValue
(1 <untyped> bigint)
flagDeckSeal
untyped bigintValue
(2 <untyped> bigint)
flagSealBox
untyped bigintValue
(4 <untyped> bigint)
phaseNames
[]stringThe value of each name is its index; 0 of result and reason is none.
- OID
- 030725…5ac0:24
phaseNames details
resultNames
[]stringThe value of each name is its index; 0 of result and reason is none.
- OID
- 030725…5ac0:26
resultNames details
reasonNames
[]stringThe value of each name is its index; 0 of result and reason is none.
- OID
- 030725…5ac0:28
reasonNames details
nameIndex
func(names []string, s string, what string) uint64- OID
- 030725…5ac0:29
nameIndex details
nameAt
func(names []string, i uint64, what string) string- OID
- 030725…5ac0:30
nameAt details
encodeMatch
func(rules *v0.Ruleset, m v0.record) string- OID
- 030725…5ac0:31
encodeMatch details
decodeMatch
func(rules *v0.Ruleset, b string) v0.record- OID
- 030725…5ac0:32
decodeMatch details
clanNibble
func(rules *v0.Ruleset, clan int) uint64clanNibble is a clan's stored form, its ruleset index plus one, checked against rules.
- OID
- 030725…5ac0:33
clanNibble details
poolOf
func(rules *v0.Ruleset, clan int) uint64poolOf returns the card pool of clan, 0 for no clan.
- OID
- 030725…5ac0:34
poolOf details
chunkRecord
func(chunk string, slot int) stringchunkRecord returns the record in slot, or "" when it is removed or beyond the chunk.
- OID
- 030725…5ac0:35
chunkRecord details
withChunkRecord
func(chunk string, slot int, rec string) stringwithChunkRecord returns chunk with slot's record set to rec, adding empty slots up to it.
- OID
- 030725…5ac0:36
withChunkRecord details
playerRecord
typeplayerRecord is what the arena keeps per player: the ids of their matches, oldest first, and the session locks that bind a session key to one match.
Value
v0.playerRecord
sessionLock
typeValue
v0.sessionLock
decodePlayer
func(s string) v0.playerRecorddecodePlayer reads a player's bytes: a 2-byte id count, the ids at 4 bytes each, then the locks. ceiling: joining a match or changing a lock rewrites all of a player's ids, up to 65,535, so gas grows with their matches; an avl index of ids per player if some play thousands.
- OID
- 030725…5ac0:37
decodePlayer details
encodePlayer
func(p v0.playerRecord) string- OID
- 030725…5ac0:38
encodePlayer details
openEntry
typeopenEntry is a challenge on the board: its match id and expiry in Unix seconds.
Value
v0.openEntry
openEntries
func(s string) []v0.openEntry- OID
- 030725…5ac0:39
openEntries details
encodeOpen
func(entries []v0.openEntry) string- OID
- 030725…5ac0:40
encodeOpen details
guard
func(fromUser bool, caller .uverse.address, m v0.record, id int)guard binds the session that signed the transaction to match id, held in m, saving the caller's record only when its locks change.
- OID
- 030725…5ac0:41
guard details
join
func(fromUser bool, caller .uverse.address, id int)join adds match id to the caller's record and binds the session that signed the transaction to it, refused when that session is bound to a match already.
- OID
- 030725…5ac0:43
join details
signingSession
func(fromUser bool) (.uverse.address, int64, bool)signingSession returns the signing session key and its expiry when fromUser: a session signs the whole transaction, so a call through another realm is left unchecked.
- OID
- 030725…5ac0:44
signingSession details
lockSession
func(locks []v0.sessionLock, session .uverse.address, expires int64, id int, opening bool, now int64) (kept []v0.sessionLock, changed bool, refusal string)lockSession binds session to match id, refused when bound to another, or any when opening. It drops expired locks and any lock its key holds under another expiry (Unix seconds, 0 never).
- OID
- 030725…5ac0:45
lockSession details
self
stringself is the arena's package path; a deploy under another path changes it.
Value
"gno.land/r/nym-gfanton001/gnomepit/arena/v0"
pagePath
untyped stringpagePath is where the page lives on its origin, the start of every trigger's link; the registry accepts only a link that starts with "/".
Value
"/gnomepit/"
init.70
func()- OID
- 030725…5ac0:47
init.70 details
tell
func(kind string, player .uverse.address, caller .uverse.address, id int, text string)tell emits kind to player about match id. It emits nothing when player made the call, so an event never names its caller.
- OID
- 030725…5ac0:49
tell details
tellBoard
func(id int, text string)tellBoard emits Board about match id, whose change altered the open-challenge list. It names no address, so a caller cannot aim it at one player's browser.
- OID
- 030725…5ac0:50
tellBoard details
tellEnded
func(m v0.record, id int, caller .uverse.address)tellEnded sends Ended to each player of the finished match m, numbered id, but caller, one event each, since gnotif reads only the first value of a repeated attribute.
- OID
- 030725…5ac0:51
tellEnded details
endText
func(m v0.record, side int) stringendText says how m ended to the player on side.
- OID
- 030725…5ac0:52
endText details
owner
*v0.Ownable- OID
- 030725…5ac0:116
owner details
retired
boolValue
false
init.77
func()- OID
- 030725…5ac0:55
init.77 details
Retire
func()Retire closes the arena to new challenges and acceptances, for good. Matches already running play out and are rated, and an open challenge can still be withdrawn. Owner only.
- OID
- 030725…5ac0:57
Retire details
TransferOwnership
func(newOwner .uverse.address)TransferOwnership makes newOwner the owner. Owner only.
- OID
- 030725…5ac0:58
TransferOwnership details
Retired
func() boolRetired reports whether the owner has retired the arena.
- OID
- 030725…5ac0:59
Retired details
Owner
func() .uverse.address- OID
- 030725…5ac0:60
Owner details
refuseSession
func()refuseSession refuses a call signed with a session key: the page signs a match's moves with one, so an owner who plays from the owner's wallet must not hand it the owner's calls.
- OID
- 030725…5ac0:61
refuseSession details
mustBeOpen
func()mustBeOpen refuses a new match on a retired arena, or on one the standings realm takes no results from.
- OID
- 030725…5ac0:62
mustBeOpen details
Accept
func(id string, clan string, deck string, plan string)Accept answers open challenge id as clan, with deck and the round-1 plan in plain text. When the challenge names an opponent, only that address may accept.
- OID
- 030725…5ac0:63
Accept details
Reveal
func(id string, deck string, deckSalt string, plan string, planSalt string, nextSeal string, nextBox string)Reveal opens the challenger's sealed plan for the round being played, and on the first reveal the sealed deck, then resolves the round. A match that goes on needs nextSeal and nextBox for the challenger's next plan; one that ends takes neither.
- OID
- 030725…5ac0:65
Reveal details
Play
func(id string, plan string)Play records the acceptor's plan for the round being played.
- OID
- 030725…5ac0:66
Play details
Resign
func(id string)Resign withdraws the caller's open challenge, expired or not, deleting it, or concedes a running match.
- OID
- 030725…5ac0:67
Resign details
ClaimForfeit
func(id string)ClaimForfeit ends a running match whose deadline has passed: the player who had to move loses. Any wallet may claim it; a session may claim only a match its wallet plays.
- OID
- 030725…5ac0:68
ClaimForfeit details
find
func(rules *v0.Ruleset, id string) (int, v0.record)- OID
- 030725…5ac0:69
find details
lookup
func(rules *v0.Ruleset, id string) (int, v0.record, bool)lookup returns the match id names, false when there is none. Only an id's own decimal text names it, never "01" or "+1".
- OID
- 030725…5ac0:70
lookup details
stateOf
func(rules *v0.Ruleset, m v0.record) v0.StatestateOf rebuilds the engine state the next round of m starts from. A round is resolved once the challenger's plan for it is stored; the specials of resolved rounds are spent.
- OID
- 030725…5ac0:71
stateOf details
checkSeal
func(seal string, salt string, text string)checkSeal panics unless seal is the sha256 of salt's bytes followed by text.
- OID
- 030725…5ac0:72
checkSeal details
clanNumber
func(rules *v0.Ruleset, clan string) intclanNumber is clan's index in rules plus one, as a record stores it, or 0 when no clan has that name.
- OID
- 030725…5ac0:73
clanNumber details
clanName
func(rules *v0.Ruleset, n int) stringclanName is the name of the clan a record stores as n, "" for none.
- OID
- 030725…5ac0:74
clanName details
planOf
func(rules *v0.Ruleset, text string) v0.PlanplanOf maps comma-separated card names to the engine's ids.
- OID
- 030725…5ac0:75
planOf details
deckBits
func(rules *v0.Ruleset, c v0.Clan, deck string) uint64deckBits returns deck as the engine's bit set, panicking unless it is legal for c. A card named twice is illegal, so a legal deck text holds exactly the deck's names.
- OID
- 030725…5ac0:76
deckBits details
legal
func(rules *v0.Ruleset, s v0.State, side v0.Side, deck uint64, p v0.Plan) bool- OID
- 030725…5ac0:77
legal details
samePlan
func(p v0.Plan, q v0.Plan) bool- OID
- 030725…5ac0:78
samePlan details
resultName
func(r v0.Result) string- OID
- 030725…5ac0:79
resultName details
reasonOf
func(s v0.State) stringreasonOf says why a finished match ended: a gnome at 0 HP or less is a knockout.
- OID
- 030725…5ac0:80
reasonOf details
MatchSummary
typeMatchSummary is one match as a player's list shows it. Round is the round being played, or the last one resolved once the match is over. ToMove is the address that must move next, empty when none. Deadline is the end of the current move's 24 hours, or the expiry of an open challenge, in Unix seconds. Opponent is the address an open challenge is reserved for, "" when anyone can accept it and once accepted.
Value
v0.MatchSummary
MatchView
typeMatchView is everything one match screen needs. Plans holds \[challenger, acceptor] for each resolved round, and for the round being played while the match runs, "" while a plan is sealed or not yet made; HP holds both sides' HP after each resolved round; Box is the challenger's encrypted pending plan, in base64.
Value
v0.MatchView
SessionLock
typeSessionLock binds the session key at address Session to the match whose id is Match. Expires is the session's expiry in Unix seconds, 0 for none.
Value
v0.SessionLock
Locks
func(player .uverse.address) []v0.SessionLockLocks lists player's session locks. It can include locks whose session has expired.
- OID
- 030725…5ac0:81
Locks details
Matches
func(player .uverse.address, offset int, limit int) []v0.MatchSummaryMatches lists player's matches, newest first: limit of them after skipping offset.
- OID
- 030725…5ac0:83
Matches details
Match
func(id string) v0.MatchViewMatch returns the view of match id.
- OID
- 030725…5ac0:84
Match details
deckText
func(rules *v0.Ruleset, deck uint64) stringdeckText names the cards of deck in card id order.
- OID
- 030725…5ac0:85
deckText details
planText
func(rules *v0.Ruleset, p v0.Plan) stringplanText names the cards of p in play order.
- OID
- 030725…5ac0:86
planText details
notFound
untyped stringValue
"# Not found\n\nThe arena has no page at this path.\n"
Render
func(path string) stringRender serves the board of open challenges at "", one player's matches at "player/\<address>", and one match at "match/\<id>".
- OID
- 030725…5ac0:87
Render details
renderBoard
func() string- OID
- 030725…5ac0:89
renderBoard details
renderPlayer
func(player .uverse.address) string- OID
- 030725…5ac0:90
renderPlayer details
renderMatch
func(v v0.MatchView) string- OID
- 030725…5ac0:91
renderMatch details
outcome
func(result string, reason string) string- OID
- 030725…5ac0:92
outcome details
matchLink
func(id string) string- OID
- 030725…5ac0:93
matchLink details
date
func(unix int64) string- OID
- 030725…5ac0:94
date details
orNone
func(s string) string- OID
- 030725…5ac0:95
orNone details
report
func(rules *v0.Ruleset, m v0.record)report sends match m, which has just ended, to the standings realm to be rated. A match its challenger accepted is not reported. Neither is any match while the arena is off the writer list, where Record would abort the ending.
- OID
- 030725…5ac0:96
report details
chunks
v0.Tree// 4-byte chunk number → chunk string
- OID
- 030725…5ac0:99
chunks details
players
v0.Tree// address → player string
- OID
- 030725…5ac0:101
players details
openList
stringValue
"\x00\x00\x00\x01j���\x00\x00\x00\x02j��\x19\x00\x00\x00\x03j��n"
chunkKey
func(id int) string- OID
- 030725…5ac0:103
chunkKey details
loadMatch
func(rules *v0.Ruleset, id int) (v0.record, bool)loadMatch returns match id, or false when it does not exist or was removed.
- OID
- 030725…5ac0:105
loadMatch details
saveMatch
func(rules *v0.Ruleset, id int, m v0.record)- OID
- 030725…5ac0:106
saveMatch details
dropMatch
func(id int)dropMatch removes match id; an absent id is left alone.
- OID
- 030725…5ac0:107
dropMatch details
putRecord
func(id int, rec string)- OID
- 030725…5ac0:108
putRecord details
stringAt
func(t *v0.Tree, key string) stringstringAt returns the string under key, "" when there is none.
- OID
- 030725…5ac0:109
stringAt details
loadPlayer
func(a .uverse.address) v0.playerRecord- OID
- 030725…5ac0:110
loadPlayer details
savePlayer
func(a .uverse.address, p v0.playerRecord)- OID
- 030725…5ac0:111
savePlayer details
openAdd
func(id int, expires int64)ceiling: each change rewrites the whole open list, 8 bytes per open challenge, so its gas grows with the board; an avl index keyed by expiry and id if the board holds thousands.
- OID
- 030725…5ac0:112
openAdd details
openRemove
func(id int)- OID
- 030725…5ac0:113
openRemove details
openNewest
func(now int64, offset int, limit int) []intopenNewest returns up to limit unexpired ids, newest first, after skipping offset of them.
- OID
- 030725…5ac0:114
openNewest details
openClear
func(now int64, max int) []intopenClear removes up to max expired entries from the front and returns their ids.
- OID
- 030725…5ac0:115