1package gnoface23import (4 "math/rand"5 "strconv"6 "strings"78 "gno.land/p/moul/entropy/v0"9 "gno.land/p/nt/ufmt/v0"10)1112func Render(path string) string {13 seed := uint64(entropy.New().Value())1415 path = strings.TrimSpace(path)16 if path != "" {17 s, err := strconv.Atoi(path)18 if err != nil {19 panic(err)20 }21 seed = uint64(s)22 }2324 output := ufmt.Sprintf("Gnoface #%d\n", seed)25 output += "```\n" + Draw(seed) + "```\n"26 return output27}2829func Draw(seed uint64) string {30 var (31 hairs = []string{32 " s",33 " .......",34 " s s s",35 " /\\ /\\",36 " |||||||",37 }38 headtop = []string{39 " /-------\\",40 " /~~~~~~~\\",41 " /|||||||\\",42 " ////////\\",43 " |||||||||",44 " /\\\\\\\\\\\\\\\\",45 }46 headspace = []string{47 " | |",48 }49 eyebrow = []string{50 "~",51 "*",52 "_",53 ".",54 }55 ear = []string{56 "o",57 " ",58 "D",59 "O",60 "<",61 ">",62 ".",63 "|",64 ")",65 "(",66 }67 eyesmiddle = []string{68 "| o o |",69 "| o _ |",70 "| _ o |",71 "| . . |",72 "| O O |",73 "| v v |",74 "| X X |",75 "| x X |",76 "| X D |",77 "| ~ ~ |",78 }79 nose = []string{80 " | o |",81 " | O |",82 " | V |",83 " | L |",84 " | C |",85 " | ~ |",86 " | . . |",87 " | . |",88 }89 mouth = []string{90 " | __/ |",91 " | \\_/ |",92 " | . |",93 " | ___ |",94 " | ~~~ |",95 " | === |",96 " | <=> |",97 }98 headbottom = []string{99 " \\-------/",100 " \\~~~~~~~/",101 " \\_______/",102 }103 )104105 r := rand.New(rand.NewPCG(seed, 0xdeadbeef))106107 return pick(r, hairs) + "\n" +108 pick(r, headtop) + "\n" +109 pick(r, headspace) + "\n" +110 " | " + pick(r, eyebrow) + " " + pick(r, eyebrow) + " |\n" +111 pick(r, ear) + pick(r, eyesmiddle) + pick(r, ear) + "\n" +112 pick(r, headspace) + "\n" +113 pick(r, nose) + "\n" +114 pick(r, headspace) + "\n" +115 pick(r, mouth) + "\n" +116 pick(r, headspace) + "\n" +117 pick(r, headbottom) + "\n"118}119120func pick(r *rand.Rand, slice []string) string {121 return slice[r.IntN(len(slice))]122}123124// based on https://github.com/moul/pipotron/blob/master/dict/ascii-face.yml125Draw(seed uint64) string
Render(path string) string
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.