Search Apps Documentation Source Content File Folder Download Copy Actions Download

hangman package

Overview

Package hangman is a classic hangman game for gno.land.

The secret word rotates every ~"day" (a fixed span of blocks) and is chosen deterministically from a built-in word list using runtime.ChainHeight(). All players share a single game per day: guesses and the wrong-count are common state. Guess a letter to reveal every matching position, or lose a life. Six wrong guesses ends the game.

Functions

Guess

func Guess(cur realm, letter string)

Guess submits a single letter for the current day's shared game. It reveals matching letters or costs a life. Aborts on bad input or when the game is already over.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/hangman" -func "Guess" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "test-13" -remote "https://rpc.test13.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test13.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/hangman" -func "Guess" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test-13" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test13.testnets.gno.land" call.tx
  

Render

func Render(path string) string

Render shows the current day's game: gallows, masked word, guesses, status.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/hangman.Render()"

Result