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.

Playground

gnomod.toml

module = "gno.land/r/g188c5k6v0tmfyevfzj962jkajjqt4ddtml8zw0x/solvers/rev1"
gno = "0.9"

[addpkg]
  creator = "g188c5k6v0tmfyevfzj962jkajjqt4ddtml8zw0x"
  height = 1373020
  max_deposit = "100000000ugnot"

rev1.gno

// Package rev1 is an example Gauntlet solution: reverse a string.
//
// This is the shape every solution takes. Solve does the work; Submit hands
// Solve to the board, which runs the tests on-chain and records the result.
package rev1

import "gno.land/r/g188c5k6v0tmfyevfzj962jkajjqt4ddtml8zw0x/gauntlet"

// Solve reverses in by runes.
func Solve(in string) string {
	r := []rune(in)
	for i, j := 0, len(r)-1; i < j; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

// Submit reveals this realm as the answer to challenge id.
func Submit(cur realm, id uint64, salt string) {
	gauntlet.Reveal(cross(cur), id, salt, Solve)
}

func Render(_ string) string {
	return "# rev1\n\nAn example [Gauntlet](/r/g188c5k6v0tmfyevfzj962jkajjqt4ddtml8zw0x/gauntlet) solution: `Solve` reverses a string.\n"
}