# 👑 King of the Dice
> ⚠️ **Experimental — generated with no human supervision.** This realm was
> produced automatically by an MCP-driven agent to exercise the gno MCP server
> and tooling, and to generate test content for gno compilers, linters and
> formatters. **Not audited. Not for production.** Full context & folder README:
> [r/moul/x/daily](https://github.com/moul/gno-contracts/blob/main/r/moul/x/daily/README.md)
---
A "king of the hill" dice game for gno.land (sapphire / gno 0.9). Call `Roll()`
to throw a deterministic 1-100 die; beat the reigning king's roll and you
dethrone them, becoming king yourself. Unlike a typical leaderboard that just
sums points, this one ranks players by **accumulated reign length in blocks**
— a single lucky high roll only pays off for as long as nobody beats it, so
outlasting the field matters more than the roll itself.
**Realm path:** `gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/kingofdice`
## Public API
| Function | Kind | Description |
| --- | --- | --- |
| `Roll(cur realm)` | crossing (tx) | Roll 1-100; dethrones the king on a higher roll. |
| `Render(path string) string` | view | Current king + reign-length leaderboard. |
## Example calls
```sh
gnokey maketx call \
-pkgpath "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/kingofdice" \
-func Roll \
-gas-fee 1000000ugnot -gas-wanted 2000000 \
-broadcast -chainid sapphire-1 -remote <rpc> <keyname>
```
View the dashboard in gnoweb at `/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/kingofdice`,
or query it:
```sh
gnokey query "vm/qrender" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/kingofdice:" -remote <rpc>
```
## Toolchain status
Verified locally: `gno test .` passes (built against a `gnolang/gno` checkout
as `GNOROOT`, since the machine's configured `GNOROOT` pointed at a stale,
deleted path). Tests avoid `gno.land/p/nt/uassert/v0` — the cached copy of
that package uses the bare `cross` builtin as a function value, which the
locally installed `gno` (master) rejects; plain `testing.T` calls sidestep
that unrelated cache/toolchain drift.
## What changed in v1
Identical behaviour to [`v0`](https://github.com/moul/gno-contracts/tree/4f2df83869b80470eb81c48a82fdbe82256b8113/r/moul/x/daily/kingofdice) apart from rendering, which now goes
through [`p/moul/kit/ui`](/p/moul/kit/ui/v0) instead of the local `medal` helper.
**One podium.** `ui.Podium` replaces the medal switch three realms each had a copy of. Same output.
The rendering change means the output differs from v0, which under this repo's versioning rule is a compatibility change, hence a new version rather than an edit in place. `v0` stays live and untouched.
<!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) -->
---
Part of **[moul/gno-contracts](https://github.com/moul/gno-contracts)** — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
**Dependency graph:**

> 🧪 **Highly experimental — potentially vibe-coded.** Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: [DISCLAIMER](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).
<!-- END GNOCONTRACTS FOOTER -->
Render(path string) string
Roll(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) string
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.