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.

z1_save_filetest.gno

1.95 Kb · 55 lines
 1// PKGPATH: gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/z1
 2
 3// Save a bot, replace it, read it back and fight it.
 4package z1
 5
 6import "gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/mybots/v3"
 7
 8func main(cur realm) {
 9	me := cur.Address().String()
10	println(mybots.Get(me))
11	mybots.Save(cross(cur), "First", "c0t5i4f3j9r3a5b5s5d5k2")
12	mybots.Save(cross(cur), "Sly Fox", "c1t3i1f6j8r6a7b2s5d4k0")
13	println(mybots.Count(), mybots.Profile(me))
14	println(mybots.Get(me))
15	println(mybots.List(0, 10))
16	println(mybots.Versus(me, 9, 2, ""))
17	println(mybots.Render(""))
18	println(mybots.Render("bot/" + me))
19}
20
21// Output:
22// null
23// 1 c1t3i1f6j8r6a7b2s5d4k0
24// {"owner":"g1uaj9za4jkmc4e49h2a2n0cru7jfv60lgcxcjf4","name":"Sly Fox","profile":"c1t3i1f6j8r6a7b2s5d4k0","class":1}
25// [{"owner":"g1uaj9za4jkmc4e49h2a2n0cru7jfv60lgcxcjf4","name":"Sly Fox","profile":"c1t3i1f6j8r6a7b2s5d4k0","class":1}]
26// 0-64
27// # Player bots
28//
29// Bots the brawler learned from how people play. Each one is a profile of eleven numbers, not code, stored as one short string. Play a few runs, then save yours from the end screen with `Save(name, profile)`; anyone can fight it, and rooms can use it as your fallback.
30//
31// | Bot | Class | Chases | Owner |
32// |---|---|---|---|
33// | [Sly Fox](:bot/g1uaj9za4jkmc4e49h2a2n0cru7jfv60lgcxcjf4) | Brawler | 67% | g1uaj9…cjf4 |
34//
35// 1 bot.
36//
37// Need testnet GNOT to play? Get it free at [faucet.gno.land](https://faucet.gno.land).
38//
39// # Sly Fox
40//
41// The bot g1uaj9…cjf4 taught by playing. It:
42//
43// - plays Brawler
44// - changes its plan every 0.3s
45// - stands still 5% of the time
46// - chases a rival who carries gold 67% of the time
47// - goes for the jackpot 89% of the time
48// - looks for gold up to 6 squares away
49// - swings at a rival in reach: 78% a tick
50// - blocks a rival in reach: 22% a tick
51// - fires its special when it pays 56% of the time
52// - dodges right after being robbed 44% of the time
53// - never runs away
54//
55// Profile: `c1t3i1f6j8r6a7b2s5d4k0`