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 rpsmatch is a best-of-three rock-paper-scissors arena against the house. Unlike a single stateless throw, a m...

Readme View source

Rock-Paper-Scissors Arena

⚠️ 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


Best-of-three rock-paper-scissors against the house, played across multiple calls instead of a single stateless throw. Each Throw plays one round of your current match (starting a new one if you don't have one in progress); the house's move is derived deterministically from the current block height, a per-realm nonce, and your address. First to two round wins takes the match, and every player's match record (wins, losses, rounds played) is kept on-chain and viewable per-address.

Realm path: gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/rpsmatch

Example calls

 1# Play one round of your current (or a new) match
 2gnokey maketx call \
 3  -pkgpath "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/rpsmatch" \
 4  -func Throw -args "rock" \
 5  -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid sapphire-1 <key>
 6
 7# View the arena dashboard
 8gnokey query vm/qrender \
 9  --data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/rpsmatch:"
10
11# View one player's record
12gnokey query vm/qrender \
13  --data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/rpsmatch:g1youraddress..."

Toolchain

Written against the sapphire (gno 0.9) stdlib split (chain, chain/runtime, gno.land/p/nt/avl/v0). The gno binary on PATH here is a newer/older mismatch of its own GNOROOT (native-function drift), so tests were run against a gno built from the exact pseudo-version pinned in that binary's own module info (github.com/gnolang/[email protected]). All 5 tests pass (gno test -v .) and gno lint . is clean.


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/rpsmatch/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 rpsmatch is a best-of-three rock-paper-scissors arena against the house. Unlike a single stateless throw, a match persists across calls: the first player to win two rounds takes the match, and every player's match record accumulates on-chain.

Constants 1

Functions 2

func Render

1func Render(path string) string
source

Render shows the arena dashboard at "", or one player's record when path is their bech32 address.

func Throw

crossing Action
1func Throw(cur realm, moveStr string) string
source

Throw plays one round of the caller's current match, starting a fresh match if none is in progress. Accepts "rock"/"paper"/"scissors" or the single-letter shorthand "r"/"p"/"s".

Types 1

type Move

ident
1type Move int
source

Move is one of rock, paper, or scissors, ordered so that (winner - loser + 3) % 3 == 1 for every winning pair.

Imports 5

Source Files 3