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 source realm

Package standings keeps Gnomepit's ratings, records, ladder and clan ratings, whatever arena version played the match...

Overview

Package standings keeps Gnomepit's ratings, records, ladder and clan ratings, whatever arena version played the match. Only realms on its owner's writer list report results.

Functions 12

func AddWriter

crossing Action
1func AddWriter(cur realm, pkgpath string)
source

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.

func IsWriter

Action
1func IsWriter(pkgpath string) bool
source

IsWriter reports whether the realm at pkgpath may report results.

func Record

crossing Action
1func Record(cur realm, challenger, acceptor address, challengerClan, acceptorClan, result string)
source

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.

func RemoveWriter

crossing Action
1func RemoveWriter(cur realm, pkgpath string)
source

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

func TransferOwnership

crossing Action
1func TransferOwnership(cur realm, newOwner address)
source

TransferOwnership makes newOwner the owner. Owner only.

func Writers

Action
1func Writers() []string
source

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

func ClanStandings

Action
1func ClanStandings() []ClanStanding
source

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.

func Results

Action
1func Results(offset, limit int) []Result
source

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

func Leaderboard

Action
1func Leaderboard(offset, limit int) []Standing
source

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

func StandingOf

Action
1func StandingOf(player address) Standing
source

StandingOf returns player's standing, rated or not.

Types 3

type ClanStanding

struct
1type ClanStanding struct {
2	Rank                int
3	Clan                string
4	Rating              int
5	Wins, Losses, Draws int
6}
source

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

type Result

struct
1type Result struct {
2	Seq                          int
3	Writer                       string
4	Challenger, Acceptor         string
5	ChallengerClan, AcceptorClan string
6	Result                       string
7	Time                         int64
8}
source

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.

type Standing

struct
1type Standing struct {
2	Rank                   int
3	Player, Name, MainClan string
4	Rating                 int
5	Wins, Losses, Draws    int
6}
source

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.

Dependencies

Source Files 9