z9_seasons_filetest.gno
2.11 Kb · 56 lines
1// PKGPATH: gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/z9
2
3// A season ends after SeasonLength blocks: its top 10 is archived and
4// ratings and season records reset, while all-time records stay.
5package z9
6
7import (
8 "testing"
9
10 "gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2"
11 _ "gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/bots/starter/v2"
12)
13
14func main(cur realm) {
15 println(arena.Fight(cross(cur), "hunter", "brawler"))
16 println(arena.Fight(cross(cur), "trickster", "coward"))
17 n, end := arena.SeasonInfo()
18 println("season", n)
19
20 testing.SkipHeights(arena.SeasonLength + 5)
21 println(arena.Fight(cross(cur), "hunter", "trickster"))
22 n2, end2 := arena.SeasonInfo()
23 println("season", n2, "ended where expected:", end2 == end+arena.SeasonLength)
24 for _, s := range arena.PastSeason(1) {
25 println("season 1:", s.Bot, s.Rating, s.Wins, s.Losses, s.Draws)
26 }
27 info, _ := arena.GetBot("brawler")
28 println("brawler now:", info.Rating, "all-time losses:", info.Losses)
29 println(arena.Render("seasons"))
30}
31
32// Output:
33// #1 hunter 0 - 3 brawler, brawler wins
34// #2 trickster 13 - 12 coward, trickster wins
35// season 1
36// #3 hunter 4 - 18 trickster, trickster wins
37// season 2 ended where expected: true
38// season 1: brawler 1216 1 0 0
39// season 1: trickster 1216 1 0 0
40// season 1: coward 1184 0 1 0
41// season 1: hunter 1184 0 1 0
42// brawler now: 1200 all-time losses: 0
43// # Seasons
44//
45// Season 2 is running. Ends at block 1440123 (about 29 days). Ratings reset each season; the top 10 is kept. [Past seasons](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2:seasons)
46//
47// ## Season 1
48//
49// | # | Bot | Elo | W-L-D |
50// |---|---|---|---|
51// | 1 | [brawler](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2:bot/brawler) | 1216 | 1-0-0 |
52// | 2 | [trickster](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2:bot/trickster) | 1216 | 1-0-0 |
53// | 3 | [coward](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2:bot/coward) | 1184 | 0-1-0 |
54// | 4 | [hunter](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2:bot/hunter) | 1184 | 0-1-0 |
55//
56// [Back to the arena](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2)