Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v0 source realm

Package numguess is a Number Guessing Game realm.

Readme View source

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


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

1# Guess 42 (via gnokey; addr/keyname/chain flags omitted for brevity)
2gnokey maketx call -pkgpath "gno.land/r/REPLACE_ADDR/numguess" \
3  -func Guess -args 42 ...
4
5# Start a new round after the current one is solved
6gnokey maketx call -pkgpath "gno.land/r/REPLACE_ADDR/numguess" \
7  -func NewRound ...

In a test or MsgRun ephemeral realm:

1import "gno.land/r/REPLACE_ADDR/numguess"
2
3hint := numguess.Guess(cross(cur), 42) // "higher" | "lower" | "correct"
4numguess.NewRound(cross(cur))          // after a solve

Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

Dependency graph:

gno.land/r/moul/x/daily/numguess/v0 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.

Overview

Package numguess is a Number Guessing Game realm.

A hidden target in 1..100 is derived deterministically from the block height at which the round started. Players call Guess(n) to receive "higher", "lower" or "correct". When a round is solved the winner is recorded on the leaderboard (ranked by fewest guesses) and anyone can start a fresh round.

Functions 3

func Guess

crossing Action
1func Guess(cur realm, n int) string
source

Guess submits a guess for the current round. It records the caller's attempt count and returns "higher", "lower" or "correct". Crossing function: caller invokes as Guess(cross(cur), n).

func NewRound

crossing Action
1func NewRound(cur realm) string
source

NewRound resets the game with a fresh target when the current round is solved. Panics if the current round is still open. Crossing function.

func Render

1func Render(path string) string
source

Render produces the gnoweb Markdown view of the current game state.

Imports 5

Source Files 3