Inserito il clock

This commit is contained in:
Giorgio Croci 2017-05-26 13:56:06 +02:00
parent 8e379a34f7
commit 71d2952617
2 changed files with 12 additions and 1 deletions

View file

@ -2,7 +2,7 @@ package main
import "fmt"
type Element struct {
type Element struct { //struttura che contiene sia cibo sia amebe
IsFood bool
Health int
Age int

11
main.go
View file

@ -5,10 +5,12 @@ import (
"math/rand"
"os"
"strconv"
"time"
)
var Matrix [][]*Element
var SaluteIniziale int
var Clock uint
func main() {
SaluteIniziale = 50
@ -42,6 +44,15 @@ func main() {
}
fmt.Println(Matrix)
go aggiorna()
}
func aggiorna() {
for {
time.Sleep(time.Second * time.Duration(Clock))
}
}
func muovi(h int, w int) { // h verticale, w orizzontale