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.

z7_reader_learns_filetest.gno

1.07 Kb · 34 lines
 1// PKGPATH: gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/z7
 2
 3// reader keeps notes on each opponent across matches. Against hunter, which
 4// always attacks up close, it learns to parry.
 5package z7
 6
 7import (
 8	"testing"
 9
10	"gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2"
11	"gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/bots/reader/v2"
12	_ "gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/bots/starter/v2"
13)
14
15func main(cur realm) {
16	for i := 0; i < 4; i++ {
17		println(arena.Fight(cross(cur), "reader", "hunter"))
18		testing.SkipHeights(arena.RatedCooldown)
19	}
20	println(reader.Render(""))
21}
22
23// Output:
24// #1 reader 9 - 0 hunter, reader wins
25// #2 reader 5 - 0 hunter, reader wins
26// #3 reader 9 - 0 hunter, reader wins
27// #4 reader 7 - 0 hunter, reader wins
28// # reader
29//
30// A realm bot that learns: it notes what each opponent does up close and plays the answer. [Record](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2:bot/reader)
31//
32// | Opponent | Attacks | Parries | Other | Reader's answer |
33// |---|---|---|---|---|
34// | hunter | 150 | 0 | 0 | parry |