maxBotsPerRealm
untyped bigintValue
(5 <untyped> bigint)
startRating
untyped bigintValue
(1200 <untyped> bigint)
Bot
typeBot is a registered bot.
Value
arena.Bot
bots
*v0.Tree// name -> \*Bot
- OID
- 03dbb1…b9f9:4
bots details
botsPerRealm
*v0.Tree// realm path -> int
- OID
- 03dbb1…b9f9:7
botsPerRealm details
RegisterBot
func(name string, b bot.Bot)RegisterBot enters a bot with a Move method. Call it from your bot realm, usually in init: func init(cur realm) { arena.RegisterBot(cross(cur), "my-bot", &myBot{}) }
- OID
- 03dbb1…b9f9:9
RegisterBot details
RegisterStrategy
func(name string, s bot.Strategy)RegisterStrategy enters a bot written as a plain function. A function declared in a /p/ package has one extra guarantee: if it crashes, the arena can catch it straight away and score a forfeit without step mode.
- OID
- 03dbb1…b9f9:11
RegisterStrategy details
register
func(name string, b *arena.Bot)- OID
- 03dbb1…b9f9:12
register details
validName
func(name string) string- OID
- 03dbb1…b9f9:13
validName details
mustBot
func(name string) *arena.Bot- OID
- 03dbb1…b9f9:14
mustBot details
BotInfo
typeBotInfo describes a bot for other realms and off-chain tools.
Value
arena.BotInfo
GetBot
func(name string) (arena.BotInfo, bool)GetBot returns public information about a bot.
- OID
- 03dbb1…b9f9:15
GetBot details
BotCount
func() intBotCount is the number of registered bots.
- OID
- 03dbb1…b9f9:16
BotCount details
bucketSize
untyped bigintValue
(16 <untyped> bigint)
recSep
untyped string// record separator inside a bucket
Value
"\x1e"
sep
untyped string// field separator; never appears in names or reasons
Value
"\x1f"
byteOffset
untyped bigint// coins (0-80) and moves (0-6) are shifted into printable bytes
Value
(40 <untyped> bigint)
codecV1
untyped stringValue
"1"
shift
func(raw string) string- OID
- 03dbb1…b9f9:17
shift details
unshift
func(enc string) string- OID
- 03dbb1…b9f9:19
unshift details
itoa
func(n int) string- OID
- 03dbb1…b9f9:20
itoa details
i64
func(n int64) string- OID
- 03dbb1…b9f9:21
i64 details
flag
func(b bool) string- OID
- 03dbb1…b9f9:22
flag details
decode
func(id int, s string) *arena.Match- OID
- 03dbb1…b9f9:23
decode details
bucketKey
func(id int) string- OID
- 03dbb1…b9f9:24
bucketKey details
bucket
func(id int) []string- OID
- 03dbb1…b9f9:25
bucket details
record
func(id int) (string, bool)record returns the stored string for match id.
- OID
- 03dbb1…b9f9:26
record details
eachRecent
func(maxScan int, fn func(...))eachRecent calls fn on matches from newest to oldest, looking at no more than maxScan of them, until fn returns true.
- OID
- 03dbb1…b9f9:27
eachRecent details
MoveTimeout
untyped bigintValue
(100 <untyped> bigint)
RatedCooldown
untyped bigintValue
(1000 <untyped> bigint)
Status
typeStatus of a match.
Value
arena.Status
Pending
arena.Status// challenged, not played yet
Value
<zero>
Stepping
arena.Status// being played one move per transaction
Value
<zero>
Finished
arena.StatusValue
<zero>
Match
typeMatch is one game between two bots. Side 0 is A, side 1 is B.
Value
arena.Match
matches
*v0.Tree// padded bucket number -> encoded matches (see codec.gno)
- OID
- 03dbb1…b9f9:29
matches details
lastID
intValue
1
claimRatedSlot
func(a string, b string) boolclaimRatedSlot reports whether a new match between a and b is rated, and if so starts the pair's cooldown. The cooldown is kept on the bot whose name sorts first, as a short "opponent@block," list that drops expired entries, so it costs a few bytes instead of a tree node per pair.
- OID
- 03dbb1…b9f9:32
claimRatedSlot details
key
func(id int) string- OID
- 03dbb1…b9f9:34
key details
height
func() int64- OID
- 03dbb1…b9f9:35
height details
emit
func(typ string, attrs []string)- OID
- 03dbb1…b9f9:36
emit details
mustMatch
func(id int) *arena.Match- OID
- 03dbb1…b9f9:37
mustMatch details
seedFor
func(id int, a string, b string) intseedFor gives every match its own board. The pair is mixed in so two matches created back to back between different bots differ too.
- OID
- 03dbb1…b9f9:38
seedFor details
Challenge
func(a string, b string) intChallenge records a new match between two registered bots and returns its id. It runs no bot code, so it always succeeds; play it with Play or, if that fails, with step mode.
- OID
- 03dbb1…b9f9:39
Challenge details
newMatch
func(a string, b string) *arena.Match- OID
- 03dbb1…b9f9:40
newMatch details
Play
func(id int) stringPlay runs the rest of a match in this transaction. If a bot written in realm code crashes or runs out of gas, the whole transaction fails and the match stays as it was: switch it to step mode with StartStepMode.
- OID
- 03dbb1…b9f9:41
Play details
Fight
func(a string, b string) stringFight challenges and plays in one transaction, saving the match once. If it fails, nothing is recorded: use Challenge, then Play or step mode.
- OID
- 03dbb1…b9f9:42
Fight details
StartStepMode
func(id int)StartStepMode switches a pending match to one move per transaction. Anyone may call it.
- OID
- 03dbb1…b9f9:43
StartStepMode details
SubmitMove
func(id int) stringSubmitMove asks the bot whose turn it is for its move and records it. The move comes from the bot's own code, so nobody can submit a fake one. Anyone may call it.
- OID
- 03dbb1…b9f9:44
SubmitMove details
ClaimForfeit
func(id int) stringClaimForfeit ends a step-mode match whose waiting bot missed its deadline. Anyone may call it.
- OID
- 03dbb1…b9f9:45
ClaimForfeit details
MatchSummary
func(id int) stringMatchSummary returns the summary of a match, for other realms and tools.
- OID
- 03dbb1…b9f9:46
MatchSummary details
MatchCount
func() intMatchCount is the number of matches ever created.
- OID
- 03dbb1…b9f9:47
MatchCount details
kFactor
untyped bigintValue
(32 <untyped> bigint)
expected
func(ra int, rb int) intexpected is a's chance of beating b, in thousandths, from an Elo-style rating gap. It uses a straight-line approximation of the logistic curve: even ratings give 500, and a gap of 400 or more is capped at 50 / 950.
- OID
- 03dbb1…b9f9:48
expected details
rate
func(a *arena.Bot, b *arena.Bot, winner int) intrate updates both ratings for a result (0, 1, or -1 for a draw) and returns the change for a (b's is the opposite).
- OID
- 03dbb1…b9f9:50
rate details
self
string// this realm's path as gnoweb links it, e.g. "/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena"
Value
"/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena"
tx
v0.Realm// builds transaction links to this realm
Value
<gnolang.StringValue>
init.57
func()- OID
- 03dbb1…b9f9:53
init.57 details
Render
func(path string) stringRender draws the arena pages in gnoweb: "" leaderboard, recent matches, rules "bot/<name>" a bot's record, source link and a challenge button "match/<id>" the final board, key moments and actions "match/<id>/<turn>" the board after one turn
- OID
- 03dbb1…b9f9:55
Render details
link
func(p string) string- OID
- 03dbb1…b9f9:56
link details
matchLink
func(id int) string- OID
- 03dbb1…b9f9:57
matchLink details
fightLink
func(a string, b string) stringfightLink opens a pre-filled Fight transaction; either name may be empty for the player to fill in.
- OID
- 03dbb1…b9f9:58
fightLink details
renderHome
func() string- OID
- 03dbb1…b9f9:59
renderHome details
leaderboard
func() []*arena.Bot- OID
- 03dbb1…b9f9:60
leaderboard details
better
func(a *arena.Bot, b *arena.Bot) bool- OID
- 03dbb1…b9f9:61
better details
sourceLink
func(realmPath string) string- OID
- 03dbb1…b9f9:62
sourceLink details
writeRecent
func(sb *strings.Builder, botName string, limit int)writeRecent lists the latest matches, optionally only those of one bot among the last 500.
- OID
- 03dbb1…b9f9:63
writeRecent details
renderBot
func(name string) string- OID
- 03dbb1…b9f9:64
renderBot details
renderMatch
func(m *arena.Match, turn int) string- OID
- 03dbb1…b9f9:65
renderMatch details
writeActions
func(sb *strings.Builder, m *arena.Match)writeActions shows the buttons that move an unfinished match along.
- OID
- 03dbb1…b9f9:66
writeActions details
writeMoments
func(sb *strings.Builder, m *arena.Match)writeMoments lists the turns where coins changed hands.
- OID
- 03dbb1…b9f9:67
writeMoments details
signed
func(n int) string- OID
- 03dbb1…b9f9:68
signed details
eventNote
func(ev game.Events, side int) string- OID
- 03dbb1…b9f9:69
eventNote details
drawBoard
func(pos [2]bot.Pos, coins []bot.Pos) string- OID
- 03dbb1…b9f9:70