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.

v0 state

Back to all declarations

addressSize

untyped bigint

// bytes in an address's text

Value

(40 <untyped> bigint)

standingFix

untyped bigint

// a standing's bytes before its per-clan counts

Value

(9 <untyped> bigint)

resultSize

untyped bigint

Value

(88 <untyped> bigint)

resultsPerChunk

untyped bigint

Value

(64 <untyped> bigint)

writer

type

Value

v0.writer

reader

type

Value

v0.reader

standing

type

standing is a player's rated record. lastClan is the clan number of their last rated match; perClan\[i] counts their rated matches with clan number i + 1.

Value

v0.standing

decodeStanding

func(s string) *v0.standing

decodeStanding reads a standing's bytes: the rating, wins, losses and draws at 2 bytes each, the last clan number at 1, then a 2-byte count per clan number played.

Open
OID
0fcff9…d416:3
decodeStanding details

Inspect func

encodeStanding

func(st *v0.standing) string
Open
OID
0fcff9…d416:5
encodeStanding details

Inspect func

ladderKey

func(rating int, player .uverse.address) string

ladderKey orders the ladder: highest rating first, then address order.

Open
OID
0fcff9…d416:6
ladderKey details

Inspect func

resultEntry

type

resultEntry is one logged result. writer is the reporting realm's writer number, clans the two clan numbers, result 'a', 'b' or 'd', and time the block's Unix seconds.

Value

v0.resultEntry

resultChunkKey

func(seq int) string

resultChunkKey is the log key of the chunk that holds result seq, 1 first.

Open
OID
0fcff9…d416:7
resultChunkKey details

Inspect func

encodeResult

func(e v0.resultEntry) string
Open
OID
0fcff9…d416:8
encodeResult details

Inspect func

decodeResult

func(s string) v0.resultEntry
Open
OID
0fcff9…d416:9
decodeResult details

Inspect func

maxPage

untyped bigint

Value

(50 <untyped> bigint)

Standing

type

Standing is one player's place on the ladder. Rank is 1 for the highest rating and equal ratings share it; Rank is 0 and Rating 1000 for a player with no rated match. Name is the player's gno.land name, "" without one. MainClan is "" until their first rated match with a counted clan.

Value

v0.Standing

ClanStanding

type

ClanStanding is one clan's record across rated cross-clan matches.

Value

v0.ClanStanding

Result

type

Result is one logged result. Seq is its place in the log, 1 first; Writer is the path of the realm that reported it. Result is "a" when the challenger won, "b" when the acceptor did, and "draw"; Time is the block's Unix seconds.

Value

v0.Result

Leaderboard

func(offset int, limit int) []v0.Standing

Leaderboard lists rated players, highest rating first: limit of them after skipping offset.

Open
OID
0fcff9…d416:10
Leaderboard details

Inspect func

StandingOf

func(player .uverse.address) v0.Standing

StandingOf returns player's standing, rated or not.

Open
OID
0fcff9…d416:12
StandingOf details

Inspect func

RatedPlayers

func() int

RatedPlayers counts the players on the ladder.

Open
OID
0fcff9…d416:13
RatedPlayers details

Inspect func

ClanStandings

func() []v0.ClanStanding

ClanStandings lists every clan with a rated cross-clan match, highest rating first; equal ratings keep first-seen order and share a rank. Clans with no such match are left out: they stand at 1000 and 0-0-0.

Open
OID
0fcff9…d416:14
ClanStandings details

Inspect func

Results

func(offset int, limit int) []v0.Result

Results lists logged results, oldest first: limit of them after skipping offset.

Open
OID
0fcff9…d416:15
Results details

Inspect func

ResultCount

func() int

ResultCount counts the logged results.

Open
OID
0fcff9…d416:16
ResultCount details

Inspect func

standingOf

func(player .uverse.address) v0.Standing

standingOf is player's standing without its rank.

Open
OID
0fcff9…d416:17
standingOf details

Inspect func

nameOf

func(player .uverse.address) string

nameOf is player's gno.land name, "" when they have none.

Open
OID
0fcff9…d416:18
nameOf details

Inspect func

clanName

func(n int) string

clanName is the name of clan number n, "" for 0, no clan.

Open
OID
0fcff9…d416:19
clanName details

Inspect func

resultName

func(b uint8) string
Open
OID
0fcff9…d416:20
resultName details

Inspect func

checkPage

func(offset int, limit int)
Open
OID
0fcff9…d416:21
checkPage details

Inspect func

startRating

untyped bigint

Value

(1000 <untyped> bigint)

maxRating

untyped bigint

// a ladder key holds the rating in 2 bytes

Value

(65535 <untyped> bigint)

playerK

untyped bigint

Value

(32 <untyped> bigint)

clanK

untyped bigint

Value

(16 <untyped> bigint)

maxClans

untyped bigint

// a clan number fills one byte of a standing and a result entry

Value

(255 <untyped> bigint)

maxPlayerCount

untyped bigint

// a player's counts are stored in 2 bytes

Value

(65535 <untyped> bigint)

maxClanCount

untyped bigint

Value

(4294967295 <untyped> bigint)

clanRecord

type

clanRecord is a clan's rating and its record in rated matches against other clans.

Value

v0.clanRecord

expectedTable

[17]int

expectedTable is the expected score, in thousandths, of a side whose opponent is rated 0, 25, …, 400 points above it: 1 / (1 + 10^(d / 400)), rounded.

Open
OID
0fcff9…d416:23
expectedTable details

Inspect array

expected

func(a int, b int) int

expected is the expected score, in thousandths, of a side rated a against one rated b. The gap is capped at 400 points and rounded to the nearest 25.

Open
OID
0fcff9…d416:24
expected details

Inspect func

eloChange

func(a int, b int, score int, k int) int

eloChange is the change, rounded to the nearest point, of a side rated a that scored score thousandths (1000 a win, 500 a draw, 0 a loss) against one rated b.

Open
OID
0fcff9…d416:26
eloChange details

Inspect func

applyChange

func(a int, b int, delta int) (int, int)

applyChange gives a the change delta and b its negative, each kept within 0 to maxRating.

Open
OID
0fcff9…d416:27
applyChange details

Inspect func

rate

func(a .uverse.address, b .uverse.address, ca int, cb int, score int)

rate counts a match between a, playing clan number ca, and b, playing clan number cb, in which a scored score thousandths: in both standings, on the ladder, and in the clan records when both clans are counted and differ.

Open
OID
0fcff9…d416:29
rate details

Inspect func

ratedStanding

func(a .uverse.address) *v0.standing

ratedStanding returns a's standing, created at startRating for a first rated match, and takes its key off the ladder until it is counted.

Open
OID
0fcff9…d416:30
ratedStanding details

Inspect func

loadStanding

func(a .uverse.address) *v0.standing

loadStanding returns a's standing, nil before their first rated match.

Open
OID
0fcff9…d416:31
loadStanding details

Inspect func

saveStanding

func(a .uverse.address, st *v0.standing)
Open
OID
0fcff9…d416:32
saveStanding details

Inspect func

clanNumber

func(name string) int

clanNumber is the clan number of name, its first-seen position plus one. A name not seen before gets the next number, or 0, no clan, once maxClans are numbered: a writer that fills the table must not abort another writer's endings.

Open
OID
0fcff9…d416:33
clanNumber details

Inspect func

scoreOf

func(result string) int

scoreOf is the challenger's score, in thousandths, in a match that ended with result.

Open
OID
0fcff9…d416:34
scoreOf details

Inspect func

tally

func(score int, wins *int, losses *int, draws *int, ceiling int)

tally adds a win, loss or draw for score, each count stopping at ceiling.

Open
OID
0fcff9…d416:35
tally details

Inspect func

rankOf

func(rating int) int

rankOf is the rank a rating holds: 1 plus the number of players rated above it.

Open
OID
0fcff9…d416:36
rankOf details

Inspect func

maxWriters

untyped bigint

// a writer number fills one byte of a result entry

Value

(255 <untyped> bigint)

maxClanName

untyped bigint

Value

(32 <untyped> bigint)

maxPkgPath

untyped bigint

Value

(256 <untyped> bigint)

writerPaths

[]string (len=1)

// every path ever a writer; its index plus one is its writer number

Open
OID
0fcff9…d416:66
writerPaths details (len=1)

+1 more Inspect slice

writers

v0.Tree

// current writer path → its writer number

Open
OID
0fcff9…d416:40
writers details

Inspect ref

players

v0.Tree

// address → standing bytes

Open
OID
0fcff9…d416:42
players details

Inspect ref

ladder

*v0.Node

// ladderKey of every rated player → nil

Value

<zero>

clans

[]v0.clanRecord

// in first-seen order; a clan's index plus one is its clan number

Value

<zero>

results

v0.Tree

// resultChunkKey → that chunk's result entries, oldest first

Open
OID
0fcff9…d416:46
results details

Inspect ref

Record

func(challenger .uverse.address, acceptor .uverse.address, challengerClan string, acceptorClan string, result string)

Record rates a match the calling arena reports as ended, and logs it. result is "a" when the challenger won, "b" when the acceptor did, and "draw". It aborts unless the caller is a realm on the writer list, and on a report no correct arena sends: the same player on both sides, another result, or a clan name that is empty or over 32 bytes.

Open
OID
0fcff9…d416:49
Record details

Inspect func

AddWriter

func(pkgpath string)

AddWriter lets the realm at pkgpath, a versioned path under gno.land/r/, report results. A path that was a writer before gets its old writer number back. Owner only.

Open
OID
0fcff9…d416:50
AddWriter details

Inspect func

RemoveWriter

func(pkgpath string)

RemoveWriter stops the realm at pkgpath from reporting results. Owner only.

Open
OID
0fcff9…d416:51
RemoveWriter details

Inspect func

TransferOwnership

func(newOwner .uverse.address)

TransferOwnership makes newOwner the owner. Owner only.

Open
OID
0fcff9…d416:52
TransferOwnership details

Inspect func

refuseSession

func()

refuseSession refuses a call signed with a session key, which its master may have handed to a page or a script: the writer list answers only to the owner's own key.

Open
OID
0fcff9…d416:53
refuseSession details

Inspect func

IsWriter

func(pkgpath string) bool

IsWriter reports whether the realm at pkgpath may report results.

Open
OID
0fcff9…d416:54
IsWriter details

Inspect func

Writers

func() []string

Writers lists the realms that may report results, in writer-number order.

Open
OID
0fcff9…d416:55
Writers details

Inspect func

isVersionedRealm

func(pkgpath string) bool

isVersionedRealm reports whether pkgpath is under gno.land/r/, at most maxPkgPath bytes of lowercase letters, digits and "/.\_-", and ends in a version element: "v" and one or more digits. A sub-realm path, with "#", is refused.

Open
OID
0fcff9…d416:58
isVersionedRealm details

Inspect func

validClan

func(name string) bool
Open
OID
0fcff9…d416:59
validClan details

Inspect func

appendResult

func(e v0.resultEntry)
Open
OID
0fcff9…d416:60
appendResult details

Inspect func

resultAt

func(seq int) v0.resultEntry

resultAt is logged result seq, 1 first.

Open
OID
0fcff9…d416:61
resultAt details

Inspect func

resultCount

func() int

resultCount counts the logged results: every chunk but the last is full.

Open
OID
0fcff9…d416:62
resultCount details

Inspect func

stringAt

func(t *v0.Tree, key string) string

stringAt is t's string at key, "" when t has none.

Open
OID
0fcff9…d416:63
stringAt details

Inspect func
addressSize : untyped bigint =(40 <untyped> bigint)
standingFix : untyped bigint =(9 <untyped> bigint)
resultSize : untyped bigint =(88 <untyped> bigint)
resultsPerChunk : untyped bigint =(64 <untyped> bigint)
writer : type =v0.writer
reader : type =v0.reader
standing : type =v0.standing
decodeStanding : func(s string) *v0.standing Inspect
encodeStanding : func(st *v0.standing) string Inspect
ladderKey : func(rating int, player .uverse.address) string Inspect
resultEntry : type =v0.resultEntry
resultChunkKey : func(seq int) string Inspect
encodeResult : func(e v0.resultEntry) string Inspect
decodeResult : func(s string) v0.resultEntry Inspect
maxPage : untyped bigint =(50 <untyped> bigint)
Standing : type =v0.Standing
ClanStanding : type =v0.ClanStanding
Result : type =v0.Result
Leaderboard : func(offset int, limit int) []v0.Standing Inspect
StandingOf : func(player .uverse.address) v0.Standing Inspect
RatedPlayers : func() int Inspect
ClanStandings : func() []v0.ClanStanding Inspect
Results : func(offset int, limit int) []v0.Result Inspect
ResultCount : func() int Inspect
standingOf : func(player .uverse.address) v0.Standing Inspect
nameOf : func(player .uverse.address) string Inspect
clanName : func(n int) string Inspect
resultName : func(b uint8) string Inspect
checkPage : func(offset int, limit int) Inspect
startRating : untyped bigint =(1000 <untyped> bigint)
maxRating : untyped bigint =(65535 <untyped> bigint)
playerK : untyped bigint =(32 <untyped> bigint)
clanK : untyped bigint =(16 <untyped> bigint)
maxClans : untyped bigint =(255 <untyped> bigint)
maxPlayerCount : untyped bigint =(65535 <untyped> bigint)
maxClanCount : untyped bigint =(4294967295 <untyped> bigint)
clanRecord : type =v0.clanRecord
expectedTable : [17]int Inspect
expected : func(a int, b int) int Inspect
eloChange : func(a int, b int, score int, k int) int Inspect
applyChange : func(a int, b int, delta int) (int, int) Inspect
clampRating : func(r int) int Inspect
rate : func(a .uverse.address, b .uverse.address, ca int, cb int, score int) Inspect
ratedStanding : func(a .uverse.address) *v0.standing Inspect
loadStanding : func(a .uverse.address) *v0.standing Inspect
saveStanding : func(a .uverse.address, st *v0.standing) Inspect
clanNumber : func(name string) int Inspect
scoreOf : func(result string) int Inspect
tally : func(score int, wins *int, losses *int, draws *int, ceiling int) Inspect
rankOf : func(rating int) int Inspect
maxWriters : untyped bigint =(255 <untyped> bigint)
maxClanName : untyped bigint =(32 <untyped> bigint)
maxPkgPath : untyped bigint =(256 <untyped> bigint)
owner : *v0.Ownable Inspect
writerPaths : []string (len=1) Inspect
writers : v0.Tree Inspect
players : v0.Tree Inspect
ladder : *v0.Node =<zero>
clans : []v0.clanRecord =<zero>
results : v0.Tree Inspect
init.60 : func() Inspect
Record : func(challenger .uverse.address, acceptor .uverse.address, challengerClan string, acceptorClan string, result string) Inspect
AddWriter : func(pkgpath string) Inspect
RemoveWriter : func(pkgpath string) Inspect
TransferOwnership : func(newOwner .uverse.address) Inspect
refuseSession : func() Inspect
IsWriter : func(pkgpath string) bool Inspect
Writers : func() []string Inspect
Owner : func() .uverse.address Inspect
addWriter : func(pkgpath string) Inspect
isVersionedRealm : func(pkgpath string) bool Inspect
validClan : func(name string) bool Inspect
appendResult : func(e v0.resultEntry) Inspect
resultAt : func(seq int) v0.resultEntry Inspect
resultCount : func() int Inspect
stringAt : func(t *v0.Tree, key string) string Inspect