From: Skullheadx Date: Sat, 16 May 2026 22:41:15 +0000 (-0400) Subject: types and some global vars X-Git-Url: http://git.skullheadx.com/nixos/static/projects/suckless.html?a=commitdiff_plain;h=42c11ef2618112277be2ee715593c98de9cb6563;p=monopoly-web.git types and some global vars --- diff --git a/game/game.go b/game/game.go new file mode 100644 index 0000000..2ded71d --- /dev/null +++ b/game/game.go @@ -0,0 +1,18 @@ +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}, +} diff --git a/go.mod b/go.mod index ec172c9..127ba66 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module skullheadx.com/monopoly-web +module monopoly-web go 1.26.2 diff --git a/main.go b/main.go index d35d86b..48ac912 100644 --- a/main.go +++ b/main.go @@ -1,26 +1,27 @@ 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") } diff --git a/types/types.go b/types/types.go new file mode 100644 index 0000000..4428028 --- /dev/null +++ b/types/types.go @@ -0,0 +1,19 @@ +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 +}