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 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 already verified on this chain by the rpsmatch realm in this repo. The gno binary on PATH here has its compiled-in GNOROOT pointing at a now-deleted directory (/private/tmp/gnoswap-review/gno), and no Go toolchain is available in this environment to rebuild a chain-matched binary per references/toolchain.md, so gno test could not be run this time. The code was instead reviewed by hand against the exact working patterns in rpsmatch (same imports, same cur.IsCurrent() / cur.Previous().Address() guard, same avl.Tree get-or-create, same chain.Emit call shape) and against Go's array-indexing-by-named-integer-type rule for the Move-keyed Counts array.


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/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 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 5

Source Files 3