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

closestguess/v0 package

Overview

Package closestguess is a blind, multiplayer number-guessing puzzle.

Unlike a classic higher/lower guessing game, closestguess gives NO feedback per guess. Each round hides a target in 1..1000 (derived deterministically from the block height the round started at); every address may submit exactly one blind Guess for the round. Whenever someone calls Reveal, the round closes: the target is disclosed, the guess with the smallest absolute distance wins (ties go to whoever guessed first), the winner is recorded on the leaderboard, and a fresh round starts immediately.

Function

Guess

func Guess(cur realm, n int) string

Guess records the caller's single blind guess for the current round. It returns no hint about correctness — that is the whole point of the puzzle. Crossing function: caller invokes as Guess(cross(cur), n).

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/moul/x/daily/closestguess/v0" -func "Guess" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/daily/closestguess/v0" -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 "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx