render_example_test.gno
1.18 Kb · 28 lines
1package rpsduel
2
3// ExampleRender pins the realm's Render output as a testable example.
4func ExampleRender() {
5 print(Render(""))
6 // Output:
7 // # Rock-Paper-Scissors Duel
8 //
9 // Challenge another address to rock-paper-scissors, async and fair: you commit your move as a hash, they reply in the open, then you reveal to settle it. Stall on revealing a losing round and your opponent can claim a forfeit win once the window expires.
10 //
11 // - Total duels resolved: 0
12 // - No champion yet -- be the first to win a duel.
13 //
14 // ## How to play
15 //
16 // 1. Pick a move and a random salt, e.g. `rock` + `xyz123`.
17 // 2. Compute your commitment: `ComputeCommit("rock", "xyz123")` (read-only call).
18 // 3. `Open(opponentAddr, commit)` -- opens the duel, returns its ID.
19 // 4. The opponent calls `Accept(id, "paper"|"scissors"|"rock")`.
20 // 5. You call `Reveal(id, "rock", "xyz123")` -- must match your commitment exactly.
21 // 6. If you never reveal, the opponent can call `ClaimForfeit(id)` after 50 blocks.
22 //
23 // View a duel at this realm's path plus its ID (e.g. `.../rpsduel:3`), or a player's record plus their address (e.g. `.../rpsduel:g1youraddress...`).
24 //
25 // ## Open duels
26 //
27 // _none right now_
28}