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

6.20 Kb · 52 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/v4",
 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(plan, salt)) with the plan text exactly as you will reveal it -> 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) over the next round; the rival plays the plan they revealed last round (or their fallback bot if they have none); returns rival model, gain, rivalGain and end positions",
23  "PlanPreviewVs(id int, side int, plans string, rival string) string": "PlanPreview with the rival model chosen: last, bot, or a style profile (pass LearnStyle(id, rivalSide) as it is)",
24  "Debrief(id int, side int) string": "replay a room and explain how side 0 (A) or 1 (B) did, round by round, with advice",
25  "LearnStyle(id int, side int) string": "turn a side's play in a room into a bot profile, to spar against with Spar",
26  "LastResult(id int) string": "last round: each side's plan, thought, gold before/after, end position, whether its bot played",
27  "InputsJSON(id int) string": "all inputs and thoughts so far; replays the match exactly",
28  "PlanHash(plan string, salt string) string": "hex sha256 of plan|salt",
29  "Compile(text string, max int) string": "optional: turn a plan of keystroke words only (run, wait, buttons) into keys: input characters. Smart plans (goto, collect, guard, ...) are never compiled: seal and reveal their text",
30  "Open() string": "rooms waiting for a player",
31  "RoomCount() int": "rooms ever created"
32 },
33 "phases": ["waiting", "sealing", "revealing", "done"],
34 "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, recharges in 3s)"},
35 "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",
36 "fallback": {"0": "easy bot", "1": "normal bot", "2": "hard bot", "3": "your bot saved in mybots"},
37 "board": "15x15 squares; 1000 units per square; x grows east, y grows south; side A starts NW, side B SE; 10 ticks per second",
38 "plan": {
39  "format": "plain text steps separated by ; or new lines, at most 500 characters; or keys: followed by one input character per tick",
40  "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>", "guard on", "guard off", "strike on", "strike off", "ahead <gold>: <step>", "behind <gold>: <step>"],
41  "notes": "ticks are 1 to 300; squares x,y are 0-14; distances take up to two decimals (melee reach is 1.45); goto slides round tables and ends on arrival; collect heads for the nearest gold; auto lets the Normal house bot play (at most 60 ticks, 6 s, in a whole plan); guard on makes every later step block by itself when the rival is within 1.5 squares and can swing, until guard off; strike on swings by itself when the rival has gold and is in melee reach, until strike off; guard and strike are one stance (turning one on turns the other off) and while either is on you stand still every third tick; ahead N: <step> or behind N: <step> runs the step only if you lead or trail by N gold, otherwise skips it for free; a landed parry takes 3 coins; a bad step is refused with an error naming it"
42 },
43 "gas": {"Create": "about 8M", "Join": "about 17M", "Seal": "about 8M", "Reveal": "about 10M", "Reveal or Advance that plays the round": "180M to 320M in live matches; it depends on both plans", "tip": "use gas-wanted 500000000 for Reveal and Advance (unused gas is not charged); a tx that runs out of gas does nothing"},
44 "errors": {
45  "room #N is revealing, not revealing (seal first; see allowedActions)": "check allowedActions in StateJSON before each call",
46  "seal a plan before revealing it": "Seal comes first, even late",
47  "this plan and salt don't match your seal": "reveal exactly the plan and salt you hashed",
48  "too early: N blocks left": "the deadline hasn't passed; wait or act",
49  "you already sealed a different plan this round": "one plan per round"
50 }
51}`
52}