z1_save_filetest.gno
1.86 Kb · 53 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"
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-48
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// # Sly Fox
38//
39// The bot g1uaj9…cjf4 taught by playing. It:
40//
41// - plays Brawler
42// - changes its plan every 0.3s
43// - stands still 5% of the time
44// - chases a rival who carries gold 67% of the time
45// - goes for the jackpot 89% of the time
46// - looks for gold up to 6 squares away
47// - swings at a rival in reach: 78% a tick
48// - blocks a rival in reach: 22% a tick
49// - fires its special when it pays 56% of the time
50// - dodges right after being robbed 44% of the time
51// - never runs away
52//
53// Profile: `c1t3i1f6j8r6a7b2s5d4k0`