Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

help.gno

5.02 Kb · 51 lines
 1package rooms
 2
 3// Help describes the whole protocol as JSON: every call with its arguments,
 4// the phases, the plan words, typical gas, and the errors you can hit. Agents
 5// can read it once instead of reading the source.
 6func Help() string {
 7	return `{
 8 "realm": "gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/rooms/v2",
 9 "faucet": "Free testnet GNOT: https://faucet.gno.land (or gno_faucet_fund in the Gno MCP server). About 2 GNOT covers a whole match.",
10 "flow": ["Create or Join", "each round: StateJSON -> PlanPreview (try plans) -> Seal(PlanHash) -> wait for phase revealing -> Reveal", "LastResult after each round", "the match ends after the last round"],
11 "calls": {
12  "Create(name string, class int, fallback int, rounds int, seconds int, phaseBlocks int) int": "open a room; returns its id. rounds 3-8 (5), seconds 60-300 (120), phaseBlocks 15-1000 (40)",
13  "Join(id int, name string, class int, fallback int)": "take the second place; the match starts",
14  "Seal(id int, hash string)": "send PlanHash(plan, salt). Allowed while sealing, and late while revealing if you haven't sealed. Same hash again is a safe no-op",
15  "Reveal(id int, plan string, salt string, thought string)": "send the plan, the salt and a thought (140 chars). Same reveal again is a safe no-op",
16  "Spar(name string, class int, fallback int, profile string, rounds int, seconds int, phaseBlocks int) int": "a solo room against a bot that plays a learned style (profile from LearnStyle); each round plays as soon as you reveal",
17  "Advance(id int)": "anyone, after the deadline: moves sealing on to revealing (late sealers can still act), or plays the round with bots for whoever didn't reveal"
18 },
19 "reads": {
20  "Help() string": "this",
21  "StateJSON(id int) string": "phase, round/rounds, blocksLeft, secondsLeft, allowedActions per player, fighters, coins [square,value], power [square,kind]; square = y*15+x",
22  "PlanPreview(id int, side int, plans string) string": "simulate up to 8 plans joined by || for side 0 (A) or 1 (B) against the rival's fallback bot; returns gain, rivalGain and end positions",
23  "Debrief(id int, side int) string": "replay a room and explain how side 0 (A) or 1 (B) did, round by round, with advice",
24  "LearnStyle(id int, side int) string": "turn a side's play in a room into a bot profile, to spar against with Spar",
25  "LastResult(id int) string": "last round: each side's plan, thought, gold before/after, end position, whether its bot played",
26  "InputsJSON(id int) string": "all inputs and thoughts so far; replays the match exactly",
27  "PlanHash(plan string, salt string) string": "hex sha256 of plan|salt",
28  "Compile(text string, max int) string": "turn a plan of keystroke words only (run, wait, buttons) into input characters",
29  "Open() string": "rooms waiting for a player",
30  "RoomCount() int": "rooms ever created"
31 },
32 "phases": ["waiting", "sealing", "revealing", "done"],
33 "classes": {"0": "hunter (long shot: knocks 1 gold loose and dazes, up to 5 squares)", "1": "brawler (haymaker: knocks 2 loose, stuns)", "2": "coward (jetpack dash with a shield)", "3": "trickster (feint: parry, or knock 1 loose)", "4": "reader (coin magnet: pulls 2 coins within 4)"},
34 "fighting": "a landed hit knocks the victim's coins onto the floor nearby (usually closest to the hitter); attacking into a block costs you a coin that goes to the blocker; 3 hits in a row within 2s each stun the rival; while one side leads by 15+, hits on the leader knock out double and new coins land in the trailer's half",
35 "fallback": {"0": "easy bot", "1": "normal bot", "2": "hard bot", "3": "your bot saved in mybots"},
36 "board": "15x15 squares; 1000 units per square; x grows east, y grows south; side A starts NW, side B SE; 10 ticks per second",
37 "plan": {
38  "format": "plain text steps separated by ; or new lines, at most 500 characters; or keys: followed by one input character per tick",
39  "words": ["run <N|NE|E|SE|S|SW|W|NW|0-15> <ticks>", "wait <ticks>", "attack", "block", "special", "dodge", "goto <x>,<y> [ticks]", "collect <ticks>", "chase <ticks>", "flee <ticks>", "if near <squares>: <attack|block|special|dodge>", "auto <ticks>"],
40  "notes": "ticks are 1 to 300; squares x,y are 0-14; goto slides round tables and ends on arrival; collect heads for the nearest gold; auto lets the Normal house bot play; a bad step is refused with an error naming it"
41 },
42 "gas": {"Create": "about 8M", "Join": "about 17M", "Seal": "about 8M", "Reveal": "about 10M", "Reveal or Advance that plays the round": "up to about 210M with smart plans (auto and collect cost most)", "tip": "use gas-wanted 300000000 for Reveal and Advance; a tx that runs out of gas does nothing"},
43 "errors": {
44  "room #N is revealing, not revealing (seal first; see allowedActions)": "check allowedActions in StateJSON before each call",
45  "seal a plan before revealing it": "Seal comes first, even late",
46  "this plan and salt don't match your seal": "reveal exactly the plan and salt you hashed",
47  "too early: N blocks left": "the deadline hasn't passed; wait or act",
48  "you already sealed a different plan this round": "one plan per round"
49 }
50}`
51}