playerStats
typeplayerStats is the persisted record for one address.
Value
v0.playerStats
players
v0.Tree// address string -> \*playerStats
- OID
- 025e52…82c1:4
players details
king
.uverse.addressValue
<zero>
kingRoll
intValue
0
reignSince
int64// chain height at which the current king took the throne
Value
0
nonce
intValue
0
totalRolls
intValue
0
get
func(addr .uverse.address) *v0.playerStatsget returns the stored \*playerStats for addr, creating one if absent.
- OID
- 025e52…82c1:10
get details
pseudoRoll
func(addr .uverse.address, nonce int, height int64) intpseudoRoll derives a deterministic 1-100 value from the caller's address, a per-call nonce, and the current chain height, so no two calls in the same block from the same address collide, yet the result can't be pre-computed off-chain before the triggering transaction lands.
- OID
- 025e52…82c1:12
pseudoRoll details
Roll
func() stringRoll throws the die for the caller. Rolling higher than the current king's roll dethrones them (crediting their finished reign in blocks) and crowns the caller as the new king.
- OID
- 025e52…82c1:13
Roll details
effectiveReignBlocks
func(ps *v0.playerStats, height int64) int64effectiveReignBlocks returns a player's accumulated reign length, including the currently-in-progress reign if they are the sitting king. It does not mutate state — it's a display-time projection.
- OID
- 025e52…82c1:14
effectiveReignBlocks details
byReign
typebyReign implements sort.Interface, ranking players by effective reign length descending, ties broken by best roll then address so the order is fully deterministic.
Value
v0.byReign
snapshot
func(height int64) ([]*v0.playerStats, []int64)snapshot collects all players ranked by effective reign length descending.
- OID
- 025e52…82c1:15
snapshot details
medal
func(rank int) stringmedal returns the emoji for a given zero-based rank, or "" past the podium.
- OID
- 025e52…82c1:16
medal details
display
func(addr .uverse.address) stringdisplay returns a shortened address for table display.
- OID
- 025e52…82c1:17
display details
Render
func(path string) stringRender shows the current king and a reign-length leaderboard.
- OID
- 025e52…82c1:18