# Number Guessing Game
> ⚠️ **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 gno.land realm (sapphire / gno 0.9) that hides a number between 1 and 100 and
lets anyone guess it. The target is derived **deterministically** from the block
height at which the round started (the GnoVM has no runtime RNG), so play is
reproducible and verifiable. Each guess returns `higher`, `lower`, or `correct`,
per-caller attempt counts are tracked, and solved rounds are recorded on a
leaderboard ranked by fewest guesses.
**Realm path:** `gno.land/r/REPLACE_ADDR/numguess`
## Playing
- `Guess(n int)` — submit a guess in `1..100`. Returns `"higher"`, `"lower"`, or
`"correct"`; increments your attempt count for the current round. Panics if the
round is already solved.
- `NewRound()` — once the current round is solved, starts a fresh round with a new
target derived from the current block height. Panics if the round is still open.
- `Render(path)` — the gnoweb view: current round number, attempts so far, the last
hint, round status, and the winners' leaderboard.
Both `Guess` and `NewRound` are gno 0.9 crossing functions (`cur realm` first
parameter), so callers invoke them with the crossing convention.
## Example calls
```sh
# Guess 42 (via gnokey; addr/keyname/chain flags omitted for brevity)
gnokey maketx call -pkgpath "gno.land/r/REPLACE_ADDR/numguess" \
-func Guess -args 42 ...
# Start a new round after the current one is solved
gnokey maketx call -pkgpath "gno.land/r/REPLACE_ADDR/numguess" \
-func NewRound ...
```
In a test or `MsgRun` ephemeral realm:
```go
import "gno.land/r/REPLACE_ADDR/numguess"
hint := numguess.Guess(cross(cur), 42) // "higher" | "lower" | "correct"
numguess.NewRound(cross(cur)) // after a solve
```
<!-- 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 -->
Guess(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}, n int) string
NewRound(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
Render(path 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.