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.

z4_step_full_filetest.gno

2.12 Kb · 57 lines
 1// PKGPATH: gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/z4
 2
 3// A match can be played partly in step mode and finished with Play.
 4package z4
 5
 6import (
 7	"gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2"
 8	_ "gno.land/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/bots/starter/v2"
 9)
10
11func main(cur realm) {
12	fast := arena.Fight(cross(cur), "hunter", "coward")
13
14	// the rematch gets a new board: play part of it in step mode
15	id := arena.Challenge(cross(cur), "hunter", "coward")
16	arena.StartStepMode(cross(cur), id)
17	for i := 0; i < 10; i++ {
18		arena.SubmitMove(cross(cur), id)
19	}
20	println("after 10 moves:", arena.MatchSummary(id))
21	arena.Play(cross(cur), id) // finish the rest in one go
22	println("fast:", fast)
23	println("mixed:", arena.MatchSummary(id))
24	println(arena.Render("match/2/3"))
25}
26
27// Output:
28// after 10 moves: #2 hunter 1 - 1 coward (step mode, turn 5 of 50)
29// fast: #1 hunter 13 - 12 coward, hunter wins
30// mixed: #2 hunter 16 - 10 coward, hunter wins (friendly)
31// # Match #2: hunter vs coward
32//
33// **#2 hunter 16 - 10 coward, hunter wins (friendly)**
34//
35// Friendly: these two bots had a rated match less than 1000 blocks before this one, so ratings don't change.
36//
37// ## After turn 3 of 50
38//
39// **A** = hunter, 0 gold · **B** = coward, 0 gold · **$** = coin
40//
41// ```
42// · · · · · · · · ·
43// · · A $ · · · · ·
44// · · $ · · · · · ·
45// · · · $ · · · $ ·
46// · · · · $ · · · ·
47// · $ · · · $ · · ·
48// · · · · · · $ · ·
49// · · · · · $ B · ·
50// · · · · · · · · ·
51// ```
52//
53// [« start](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2:match/2/0) · [‹ prev](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2:match/2/2) · [next ›](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2:match/2/4) · [end »](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2:match/2/50)
54//
55// Turn 3: hunter **down**, coward **up**
56//
57// Bots: [hunter](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2:bot/hunter) · [coward](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2:bot/coward) · [Back to the arena](/r/g1ftppd2jpfx0p8cy08th4u9whwvqcpychhlad28/arena/v2)