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