--- /dev/null
+package game
+
+import (
+ "monopoly-web/types"
+)
+
+const MaxPlayers int32 = 8
+
+var Users [MaxPlayers]types.User
+
+var Properties = [22]types.Property{
+ {Name: "Mediterranean Avenue", Price: 60, Mortgaged: false, Rent: [6]int32{2, 10, 30, 90, 160, 250}, MortgageValue: 30},
+}
+
+var Rent = [22][6]int{
+ //b,1h, 2h,3h,4h,hotel
+ {2, 10, 30, 90, 160, 250},
+}
-module skullheadx.com/monopoly-web
+module monopoly-web
go 1.26.2
package main
import (
-
"fmt"
"io"
"log"
+ "monopoly-web/game"
+ "monopoly-web/types"
"net/http"
-
-);
-
+)
func main() {
fmt.Println("monopoly-web backend")
+ game.Users[0] = types.User{UUID: "abc", Money: 100}
+ fmt.Println(game.Users)
+
// register routes
http.HandleFunc("/health", healthHandler)
-
// listen and serve
- log.Fatal(http.ListenAndServe(":8080",nil))
+ log.Fatal(http.ListenAndServe(":8080", nil))
}
func healthHandler(w http.ResponseWriter, req *http.Request) {
- io.WriteString(w, "Status: healthy\n")
+ io.WriteString(w, "Status: healthy\n")
}
--- /dev/null
+package types
+
+type User struct {
+ UUID string
+ Money int32
+}
+
+type Square struct {
+ Name string
+ Class string
+}
+
+type Property struct {
+ Name string
+ Price int32
+ Mortgaged bool
+ Rent [6]int32
+ MortgageValue int32
+}