Niente di nuovo

This commit is contained in:
Giorgio Croci 2017-05-26 16:15:28 +02:00
parent aafe0566d7
commit 2d6a0b72a6
2 changed files with 12 additions and 9 deletions

View File

@ -17,10 +17,10 @@ func (e Element) String() string {
return fmt.Sprintf("<E'Cibo=%t Salute=%d Eta=%d>", e.IsFood, e.Health, e.Age)
}
func Costruttore(razza string, evoluzione int, costomov int, costosex int, premura int) *Element {
func Costruttore(razza string, evoluzione int, costomov int, costosex int, premura int, salute int) *Element {
nuovo := new(Element)
nuovo.IsFood=false
nuovo.Health=100
nuovo.Health=salute
nuovo.Age=0
nuovo.Razza=razza
nuovo.Evoluzione=evoluzione

17
main.go
View File

@ -119,13 +119,13 @@ func muovi(h int, w int) { //FUNZIONE MUOVI: aggiorna la posizione di tutti gli
}
if (elemento.Health-elemento.Premura)>elemento.CostoSex { //se ha energia a sufficienza per riprodursi
Matrix[h][w] = Costruttore(elemento.Razza, elemento.Evoluzione, elemento.CostoMov, elemento.CostoSex, elemento.Premura)
Matrix[h][w] = Costruttore(elemento.Razza, elemento.Evoluzione, elemento.CostoMov, elemento.CostoSex, elemento.Premura, SaluteIniziale)
}
}
}
func stampaMatrice2() {
/*func stampaMatrice2() {
for i := 0; i < Altezza; i++ {
fmt.Printf("Riga %d:\n", i)
for j := 0; j < Larghezza; j++ {
@ -139,17 +139,20 @@ func stampaMatrice2() {
fmt.Printf(" Colonna %d: %s\n", j, stringa)
}
}
}
}*/
func stampaMatrice() {
for i := 0; i < Altezza; i++ {
for j := 0; j < Larghezza; j++ {
if Matrix[i][j]!=nil {
fmt.Printf("0 ")
if Matrix[i][j] == nil {
fmt.Printf("-- ")
} else {
fmt.Printf("1 ")
if Matrix[i][j].IsFood {
fmt.Printf("CC ")
} else {
fmt.Printf("%d ", Matrix[i][j].Health)
}
}
fmt.Printf(" Colonna %d: %s\n")
}
fmt.Printf("\n")
}