]> Skullheadx's Git Forge - monopoly-web.git/commitdiff
types and some global vars
authorSkullheadx <admonty1@protonmail.com>
Sat, 16 May 2026 22:41:15 +0000 (18:41 -0400)
committerSkullheadx <admonty1@protonmail.com>
Sat, 16 May 2026 22:41:15 +0000 (18:41 -0400)
game/game.go [new file with mode: 0644]
go.mod
main.go
types/types.go [new file with mode: 0644]

diff --git a/game/game.go b/game/game.go
new file mode 100644 (file)
index 0000000..2ded71d
--- /dev/null
@@ -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 ec172c901290fde3b40bad90cae686aed7754023..127ba6665a59a89280fc1a446a96836deeb76f11 100644 (file)
--- 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 d35d86ba0bc80b679ee2f9ee47ab2ede296000cb..48ac912d136fdfaa9452c77169e9992ef2c5d95a 100644 (file)
--- 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 (file)
index 0000000..4428028
--- /dev/null
@@ -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
+}