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

v1 source realm

Package rpsoracle is a rock-paper-scissors opponent that doesn't roll dice: it studies each player's move history and...

Readme View source

Rock-Paper-Scissors Oracle

⚠️ 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 rock-paper-scissors opponent that doesn't roll dice — it studies you. The oracle tallies every move you've ever thrown and always counters whichever one you favor most, so a fixed habit gets punished while a genuinely mixed (roughly 1/3-1/3-1/3) strategy is unbeatable in the long run. It's a live, playable demo of the rock-paper-scissors mixed-strategy Nash equilibrium: Render shows your win/loss/draw record, your move-history breakdown, and a "predictability score" (your most-played move's share of your rounds — lower means the oracle has less to work with).

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

Example calls

 1# Play one round — the oracle predicts from your move history, then counters
 2gnokey maketx call \
 3  -pkgpath "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/rpsoracle" \
 4  -func Play -args "rock" \
 5  -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid sapphire-1 <key>
 6
 7# View the oracle's dashboard (total rounds, oracle win rate, top outwitter)
 8gnokey query vm/qrender \
 9  --data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/rpsoracle:"
10
11# View one player's record and move-history breakdown
12gnokey query vm/qrender \
13  --data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/rpsoracle:g1youraddress..."

Toolchain

Written against the sapphire (gno 0.9) stdlib split (chain, chain/runtime, gno.land/p/nt/avl/v0, gno.land/p/nt/testutils/v0), following the same crossing-function (cur realm) and avl.Tree-backed state patterns as the rpsmatch realm in this repo.

v0's README noted that gno test could not be run when it was written, because the gno on PATH embedded a GNOROOT pointing at a deleted directory. That no longer applies: v1 is tested, with gno built from origin/master, and it passes make test and make lint alongside the rest of the repo.

What changed in v1

Identical behaviour to v0 apart from rendering, which now goes through p/moul/kit/ui instead of the local escapeInline helper.

Real escaping. The local helper replaced a handful of markdown metacharacters. ui.Inline and ui.Cell delegate to p/nt/markdown/sanitize, which also strips bidi and zero-width characters and folds newlines, so user text cannot reorder or escape the line it sits on.

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.


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/rpsoracle/v1 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 rpsoracle is a rock-paper-scissors opponent that doesn't roll dice: it studies each player's move history and always throws the counter to whichever move that player has favored most. Play a fixed pattern and the oracle punishes it; play close to a uniform 1/3-1/3-1/3 mix and it can't out-guess you better than chance.

Constants 1

Functions 2

func Play

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

Play pits the caller against the oracle: it predicts your next move from your own move history and throws the counter. Accepts "rock"/"paper"/"scissors" or the single-letter shorthand "r"/"p"/"s".

func Render

1func Render(path string) string
source

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

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 6

Source Files 5