z0_filetest.gno
1.39 Kb ยท 105 lines
1package main
2
3import (
4 "os"
5 "time"
6
7 "gno.land/p/demo/tamagotchi"
8)
9
10func main() {
11 t := tamagotchi.New("Gnome")
12
13 println("\n-- INITIAL\n")
14 println(t.Markdown())
15
16 println("\n-- WAIT 20 minutes\n")
17 os.Sleep(20 * time.Minute)
18 println(t.Markdown())
19
20 println("\n-- FEEDx3, PLAYx2, HEALx4\n")
21 t.Feed()
22 t.Feed()
23 t.Feed()
24 t.Play()
25 t.Play()
26 t.Heal()
27 t.Heal()
28 t.Heal()
29 t.Heal()
30 println(t.Markdown())
31
32 println("\n-- WAIT 20 minutes\n")
33 os.Sleep(20 * time.Minute)
34 println(t.Markdown())
35
36 println("\n-- WAIT 20 hours\n")
37 os.Sleep(20 * time.Hour)
38 println(t.Markdown())
39
40 println("\n-- WAIT 20 hours\n")
41 os.Sleep(20 * time.Hour)
42 println(t.Markdown())
43}
44
45// Output:
46//
47// -- INITIAL
48//
49// # Gnome ๐
50//
51// * age: 0
52// * hunger: 50
53// * happiness: 50
54// * health: 50
55// * sleepy: 0
56//
57// -- WAIT 20 minutes
58//
59// # Gnome ๐
60//
61// * age: 0
62// * hunger: 70
63// * happiness: 30
64// * health: 30
65// * sleepy: 20
66//
67// -- FEEDx3, PLAYx2, HEALx4
68//
69// # Gnome ๐
70//
71// * age: 0
72// * hunger: 40
73// * happiness: 50
74// * health: 70
75// * sleepy: 20
76//
77// -- WAIT 20 minutes
78//
79// # Gnome ๐
80//
81// * age: 0
82// * hunger: 60
83// * happiness: 30
84// * health: 50
85// * sleepy: 40
86//
87// -- WAIT 20 hours
88//
89// # Gnome ๐ต
90//
91// * age: 20
92// * hunger: 0
93// * happiness: 0
94// * health: 0
95// * sleepy: 0
96//
97// -- WAIT 20 hours
98//
99// # Gnome ๐ต
100//
101// * age: 20
102// * hunger: 0
103// * happiness: 0
104// * health: 0
105// * sleepy: 0