jsonString
func(s string) string- OID
- 00df69…e035:3
jsonString details
jsonObj
typeValue
v2.jsonObj
jsonArray
func(items []string) string- OID
- 00df69…e035:5
jsonArray details
posJSON
func(p bot.Pos) string- OID
- 00df69…e035:6
posJSON details
botJSON
func(b *v2.Bot) string- OID
- 00df69…e035:7
botJSON details
ArenaJSON
func() stringArenaJSON returns counts, the current season and the block height.
- OID
- 00df69…e035:8
ArenaJSON details
BotsJSON
func() stringBotsJSON returns every bot, ranked like the leaderboard.
- OID
- 00df69…e035:9
BotsJSON details
BotJSON
func(name string) stringBotJSON returns one bot, with its earlier versions.
- OID
- 00df69…e035:10
BotJSON details
matchSummaryJSON
func(m *v2.Match) string- OID
- 00df69…e035:11
matchSummaryJSON details
MatchesJSON
func(botName string, limit int) stringMatchesJSON returns up to limit matches, newest first, optionally only those of one bot (looking at no more than the last 500).
- OID
- 00df69…e035:12
MatchesJSON details
MatchJSON
func(id int) stringMatchJSON returns a match with every turn, for replays: positions, gold and coins after each turn, both actions and what happened.
- OID
- 00df69…e035:13
MatchJSON details
frameJSON
func(g *game.Game, acts [2]bot.Action, ev game.Events) string- OID
- 00df69…e035:14
frameJSON details
tournamentJSON
func(t *v2.Tournament, full bool) string- OID
- 00df69…e035:15
tournamentJSON details
TournamentsJSON
func() stringTournamentsJSON returns every tournament, newest first.
- OID
- 00df69…e035:16
TournamentsJSON details
TournamentJSON
func(id int) stringTournamentJSON returns one tournament with its table and schedule.
- OID
- 00df69…e035:17
TournamentJSON details
SeasonsJSON
func() stringSeasonsJSON returns the top 10 of every finished season, newest first.
- OID
- 00df69…e035:18
SeasonsJSON details
maxBotsPerRealm
untyped bigintValue
(5 <untyped> bigint)
startRating
untyped bigintValue
(1200 <untyped> bigint)
Bot
typeBot is a registered bot.
Value
v2.Bot
bots
*v0.Tree// name -> \*Bot
- OID
- 00df69…e035:20
bots details
botsPerRealm
*v0.Tree// realm path -> int
- OID
- 00df69…e035:23
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
- 00df69…e035:25
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
- 00df69…e035:27
RegisterStrategy details
register
func(name string, b *v2.Bot)- OID
- 00df69…e035:28
register details
reserveRealmSlot
func(realmPath string)reserveRealmSlot counts one more bot for realmPath, up to maxBotsPerRealm.
- OID
- 00df69…e035:29
reserveRealmSlot details
currentOrigin
func() .uverse.address- OID
- 00df69…e035:30
currentOrigin details
validName
func(name string) string- OID
- 00df69…e035:31
validName details
mustBot
func(name string) *v2.Bot- OID
- 00df69…e035:32
mustBot details
BotInfo
typeBotInfo describes a bot for other realms and off-chain tools.
Value
v2.BotInfo
GetBot
func(name string) (v2.BotInfo, bool)GetBot returns public information about a bot.
- OID
- 00df69…e035:33
GetBot details
BotCount
func() intBotCount is the number of registered bots.
- OID
- 00df69…e035:34
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)
codecV2
untyped stringValue
"2"
shift
func(raw string) string- OID
- 00df69…e035:35
shift details
unshift
func(enc string) string- OID
- 00df69…e035:37
unshift details
itoa
func(n int) string- OID
- 00df69…e035:38
itoa details
i64
func(n int64) string- OID
- 00df69…e035:39
i64 details
flag
func(b bool) string- OID
- 00df69…e035:40
flag details
decode
func(id int, s string) *v2.Match- OID
- 00df69…e035:41
decode details
bucketKey
func(id int) string- OID
- 00df69…e035:42
bucketKey details
bucket
func(id int) []string- OID
- 00df69…e035:43
bucket details
record
func(id int) (string, bool)record returns the stored string for match id.
- OID
- 00df69…e035:44
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
- 00df69…e035:45
eachRecent details
MoveTimeout
untyped bigintValue
(100 <untyped> bigint)
RatedCooldown
untyped bigintValue
(1000 <untyped> bigint)
Status
typeStatus of a match.
Value
v2.Status
Pending
v2.Status// challenged, not played yet
Value
<zero>
Stepping
v2.Status// being played one move per transaction
Value
<zero>
Finished
v2.StatusValue
<zero>
Match
typeMatch is one game between two bots. Side 0 is A, side 1 is B.
Value
v2.Match
matches
*v0.Tree// padded bucket number -> encoded matches (see codec.gno)
- OID
- 00df69…e035:47
matches details
lastID
intValue
14
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
- 00df69…e035:50
claimRatedSlot details
key
func(id int) string- OID
- 00df69…e035:52
key details
height
func() int64- OID
- 00df69…e035:53
height details
emit
func(typ string, attrs []string)- OID
- 00df69…e035:54
emit details
mustMatch
func(id int) *v2.Match- OID
- 00df69…e035:55
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
- 00df69…e035:56
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
- 00df69…e035:57
Challenge details
newMatch
func(a string, b string) *v2.Match- OID
- 00df69…e035:58
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
- 00df69…e035:59
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
- 00df69…e035:60
Fight details
StartStepMode
func(id int)StartStepMode switches a pending match to one move per transaction. Anyone may call it.
- OID
- 00df69…e035:61
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
- 00df69…e035:62
SubmitMove details
ClaimForfeit
func(id int) stringClaimForfeit ends a step-mode match whose waiting bot missed its deadline. Anyone may call it.
- OID
- 00df69…e035:63
ClaimForfeit details
MatchSummary
func(id int) stringMatchSummary returns the summary of a match, for other realms and tools.
- OID
- 00df69…e035:64
MatchSummary details
MatchCount
func() intMatchCount is the number of matches ever created.
- OID
- 00df69…e035:65
MatchCount details
maxDescription
untyped bigintValue
(200 <untyped> bigint)
mustOwn
func(name string) *v2.Bot- OID
- 00df69…e035:66
mustOwn details
cleanText
func(s string) stringcleanText keeps a description on one line and drops characters that would turn it into markdown links, images, tables or HTML on the bot's page.
- OID
- 00df69…e035:68
cleanText details
SetDescription
func(name string, text string)SetDescription sets the one-line description shown on the bot's page.
- OID
- 00df69…e035:69
SetDescription details
Retire
func(name string)Retire takes a bot off the leaderboard and stops new challenges against it. Its history stays. Matches already created can still be finished.
- OID
- 00df69…e035:70
Retire details
Unretire
func(name string)Unretire brings a retired bot back.
- OID
- 00df69…e035:71
Unretire details
UpgradeBot
func(name string, b bot.Bot)UpgradeBot points an existing bot at new code, keeping its name, rating and record. Call it from the new bot realm's init, sent by the bot's owner: func init(cur realm) { arena.UpgradeBot(cross(cur), "my-bot", &myBotV2{}) }
- OID
- 00df69…e035:72
UpgradeBot details
UpgradeStrategy
func(name string, s bot.Strategy)UpgradeStrategy is UpgradeBot for a bot written as a plain function.
- OID
- 00df69…e035:73
UpgradeStrategy details
upgrade
func(name string, impl bot.Bot, fn bot.Strategy)- OID
- 00df69…e035:74
upgrade details
appendHistory
func(h string, realmPath string) stringappendHistory adds a realm to a bot's "realm@block," history.
- OID
- 00df69…e035:75
appendHistory 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
- 00df69…e035:76
expected details
rate
func(a *v2.Bot, b *v2.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
- 00df69…e035:78
rate details
self
string// this realm's path as gnoweb links it, e.g. "/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2"
Value
"/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2"
tx
v0.Realm// builds transaction links to this realm
Value
<gnolang.StringValue>
init.85
func()- OID
- 00df69…e035:81
init.85 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 "tournaments" all tournaments "tournament/<id>" a tournament's table, schedule and actions "seasons" champions of past seasons
- OID
- 00df69…e035:83
Render details
link
func(p string) string- OID
- 00df69…e035:84
link details
matchLink
func(id int) string- OID
- 00df69…e035:85
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
- 00df69…e035:86
fightLink details
renderHome
func() string- OID
- 00df69…e035:87
renderHome details
leaderboard
func() []*v2.Bot- OID
- 00df69…e035:88
leaderboard details
better
func(a *v2.Bot, b *v2.Bot) bool- OID
- 00df69…e035:89
better details
sourceLink
func(realmPath string) string- OID
- 00df69…e035:90
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
- 00df69…e035:91
writeRecent details
renderBot
func(name string) string- OID
- 00df69…e035:92
renderBot details
renderMatch
func(m *v2.Match, turn int) string- OID
- 00df69…e035:93
renderMatch details
writeActions
func(sb *strings.Builder, m *v2.Match)writeActions shows the buttons that move an unfinished match along.
- OID
- 00df69…e035:94
writeActions details
writeMoments
func(sb *strings.Builder, m *v2.Match)writeMoments lists the turns where coins changed hands.
- OID
- 00df69…e035:95
writeMoments details
signed
func(n int) string- OID
- 00df69…e035:96
signed details
eventNote
func(ev game.Events, side int) string- OID
- 00df69…e035:97
eventNote details
drawBoard
func(pos [2]bot.Pos, coins []bot.Pos) string- OID
- 00df69…e035:98
drawBoard details
blockSeconds
untyped bigdecblockSeconds is Onyx's approximate block time, for "about N days" hints.
Value
(3.6 <untyped> bigdec)
seasonLine
func() stringseasonLine describes the current season's timing.
- OID
- 00df69…e035:99
seasonLine details
activeLeaderboard
func() []*v2.BotactiveLeaderboard is the leaderboard without retired bots.
- OID
- 00df69…e035:101
activeLeaderboard details
writeTournamentList
func(sb *strings.Builder, limit int)- OID
- 00df69…e035:102
writeTournamentList details
renderTournaments
func() string- OID
- 00df69…e035:103
renderTournaments details
renderTournament
func(t *v2.Tournament) string- OID
- 00df69…e035:104
renderTournament details
renderSeasons
func() string- OID
- 00df69…e035:105
renderSeasons details
SeasonLength
untyped bigintSeasonLength is about 30 days at Onyx's ~3.6 s blocks.
Value
(720000 <untyped> bigint)
season
intValue
1
seasonStart
int64// set on the first activity
Value
1455149
pastSeasons
*v0.Tree// padded season number -> "name:rating:w-l-d," top 10
- OID
- 00df69…e035:109
pastSeasons details
seasonTop
intValue
10
SeasonInfo
func() (number int, endsAt int64)SeasonInfo reports the current season number and the block it ends at.
- OID
- 00df69…e035:112
SeasonInfo details
rollSeason
func()rollSeason closes the current season if it is over. Call it before any state change that touches ratings.
- OID
- 00df69…e035:114
rollSeason details
closeSeason
func()- OID
- 00df69…e035:115
closeSeason details
SeasonStanding
typeSeasonStanding is one line of a finished season's top 10.
Value
v2.SeasonStanding
PastSeason
func(number int) []v2.SeasonStandingPastSeason returns the top 10 of a finished season.
- OID
- 00df69…e035:116
PastSeason details
minEntrants
untyped bigintValue
(2 <untyped> bigint)
maxEntrants
untyped bigintValue
(8 <untyped> bigint)
TournamentStatus
typeTournamentStatus of a tournament.
Value
v2.TournamentStatus
Open
v2.TournamentStatusValue
<zero>
Running
v2.TournamentStatusValue
<zero>
Done
v2.TournamentStatusValue
<zero>
Tournament
typeTournament is a round-robin between up to maxEntrants bots.
Value
v2.Tournament
tournaments
*v0.Tree// padded id -> \*Tournament
- OID
- 00df69…e035:118
tournaments details
lastTID
intValue
1
mustTournament
func(id int) *v2.Tournament- OID
- 00df69…e035:121
mustTournament details
CreateTournament
func(name string, capacity int) intCreateTournament opens a round-robin for up to capacity bots (2 to 8).
- OID
- 00df69…e035:123
CreateTournament details
JoinTournament
func(id int, botName string)JoinTournament enters a bot you own into an open tournament.
- OID
- 00df69…e035:124
JoinTournament details
StartTournament
func(id int)StartTournament closes entries and fixes the schedule. Only the creator can start it.
- OID
- 00df69…e035:125
StartTournament details
roundRobin
func(entrants []string) []stringroundRobin schedules every pair once, round by round (circle method), so no bot plays twice in a row more than it must. Sides alternate by round.
- OID
- 00df69…e035:126
roundRobin details
NextTournamentMatch
func(id int) intNextTournamentMatch creates the tournament's next match and returns its id. Play it with Play, or step mode if a bot keeps it from finishing. Anyone may call it.
- OID
- 00df69…e035:127
NextTournamentMatch details
PlayTournament
func(id int) stringPlayTournament creates the next match and plays it in one transaction. If a bot makes it fail, nothing is recorded: use NextTournamentMatch, then Play or step mode. Anyone may call it.
- OID
- 00df69…e035:128
PlayTournament details
CloseTournament
func(id int)CloseTournament marks a tournament finished once all its matches are settled (matches finished through step mode don't do it themselves). Anyone may call it.
- OID
- 00df69…e035:129
CloseTournament details
Standing
typeStanding is one bot's line in a tournament table.
Value
v2.Standing
aheadOf
func(a v2.Standing, b v2.Standing) bool- OID
- 00df69…e035:130
aheadOf details
TournamentCount
func() intTournamentCount is the number of tournaments ever created.
- OID
- 00df69…e035:131
TournamentCount details
TournamentNext
func(id int) (a string, b string, ok bool)TournamentNext returns the next pairing still to be created, if any.
- OID
- 00df69…e035:132