This commit is contained in:
Giorgio Croci 2017-05-26 15:38:59 +02:00
commit 655d3eab0c
4 changed files with 64 additions and 32 deletions

View File

@ -6,6 +6,7 @@
h1 {
color: white;
text-align: center;
font-size:2.4em;
}
body{
background: #009999;
@ -13,35 +14,43 @@
table{
border: 1px solid white;
empty-cells: show;
background: white;
padding: 0px;
width:100%;
height: 80%;
height: 89%;
}
td,tr{
background: white;
width: 100px
height: 10px
padding: 0px
}
td.cibo{
background: #FFFF33;
padding: 0px
}
td.razza1{
background: #00ff00;
padding: 0px
}td.razza2{
background: #FF0000;
padding: 0px
}
</style>
</head>
<body>
<h1> Go bug</h1>
<table>
<tr>
<th></th>
<th></th>
<th></th>
<td class="cibo"></th>
<td class="razza1"></td>
<td class="razza2"></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>

20
html.go Normal file
View File

@ -0,0 +1,20 @@
package main
import (
"html/template"
"net/http"
)
// ServiHTML fa partire il server html
func ServiHTML() {
http.HandleFunc("/", handlerRoot)
http.ListenAndServe(":3000", nil)
}
func handlerRoot(w http.ResponseWriter, r *http.Request) {
templ, err := template.ParseFiles("template/hello.html")
if err != nil {
panic(err.Error())
}
templ.Execute(w, new(interface{}))
}

View File

@ -51,6 +51,9 @@ func main() { //FUNZIONE MAIN
}
}
}
go ServiHTML() // fai partire il server html
fmt.Println("Situazione iniziale: ")
stampaMatrice()
@ -89,7 +92,6 @@ func muovi(h int, w int) { //FUNZIONE MUOVI: aggiorna la posizione di tutti gli
}
if tmpNewElem := Matrix[nuovaPosizioneH][nuovaPosizioneW]; tmpNewElem != nil {
if tmpNewElem.Razza != elemento.Razza { //se non è dalla stessa razza
if tmpNewElem.IsFood || (tmpNewElem.Health+tmpNewElem.Evoluzione) < (elemento.Health+elemento.Evoluzione) { // se e' cibo o un insetto piu debole
elemento.Health += tmpNewElem.Health //prelevamento energia essere fagocitato

1
template/hello.html Normal file
View File

@ -0,0 +1 @@
hello