]> Skullheadx's Git Forge - monopoly-web.git/commitdiff
property static data
authorSkullheadx <admonty1@protonmail.com>
Sun, 17 May 2026 01:09:09 +0000 (21:09 -0400)
committerSkullheadx <admonty1@protonmail.com>
Sun, 17 May 2026 01:09:09 +0000 (21:09 -0400)
game/color.go [new file with mode: 0644]
game/game.go
game/movement.go
game/types.go

diff --git a/game/color.go b/game/color.go
new file mode 100644 (file)
index 0000000..78181b2
--- /dev/null
@@ -0,0 +1,21 @@
+package game
+
+// var ColorRent = [22][6]int{
+//     //b,1h, 2h,3h,4h,hotel
+//     {2, 10, 30, 90, 160, 250},
+// }
+
+// var Colors = [22]Color
+//
+//
+//     {
+//     {spaceID: 1, Name: "Mediterranean Avenue", Price: 60, Mortgaged: false, Rent: [6]int32{2, 10, 30, 90, 160, 250}, MortgageValue: 30},
+// }
+
+func ProcessColor() {
+       // for _, cV := range ColorVisitors {
+       //      pID := cV.playerID
+       //      sID := cV.spaceID
+       //
+       // }
+}
index 53699b4341bcf29041b8577f48d09c6f36d3015d..0a95690a869f45ca637b8d99476a5cbe9e2be002 100644 (file)
@@ -4,69 +4,6 @@ const MaxPlayers int32 = 8
 
 var Users [MaxPlayers]User
 
-var BoardSpaceTypes = [40]PropertyType{
-       0:  TypeGo,
-       1:  TypeColor,
-       2:  TypeChest,
-       3:  TypeColor,
-       4:  TypeTax,
-       5:  TypeRailroad,
-       6:  TypeColor,
-       7:  TypeChance,
-       8:  TypeColor,
-       9:  TypeColor,
-       10: TypeJail,
-       11: TypeColor,
-       12: TypeUtility,
-       13: TypeColor,
-       14: TypeColor,
-       15: TypeRailroad,
-       16: TypeColor,
-       17: TypeChest,
-       18: TypeColor,
-       19: TypeColor,
-       20: TypeParking,
-       21: TypeColor,
-       22: TypeChance,
-       23: TypeColor,
-       24: TypeColor,
-       25: TypeRailroad,
-       26: TypeColor,
-       27: TypeColor,
-       28: TypeUtility,
-       29: TypeColor,
-       30: TypeJail,
-       31: TypeColor,
-       32: TypeColor,
-       33: TypeChest,
-       34: TypeColor,
-       35: TypeRailroad,
-       36: TypeChance,
-       37: TypeColor,
-       38: TypeTax,
-       39: TypeColor,
-}
-
-var (
-       GoVisitors       []int32
-       ColorVisitors    []int32
-       ChestVisitors    []int32
-       TaxVisitors      []int32
-       RailroadVisitors []int32
-       ChanceVisitors   []int32
-       JailVisitors     []int32
-       UtilityVisitors  []int32
-       ParkingVisitors  []int32
-       PoliceVisitors   []int32
-)
-
-// var ColorRent = [22][6]int{
-//     //b,1h, 2h,3h,4h,hotel
-//     {2, 10, 30, 90, 160, 250},
-// }
-// var Colors = [22]Color{
-//     {Name: "Mediterranean Avenue", Price: 60, Mortgaged: false, Rent: [6]int32{2, 10, 30, 90, 160, 250}, MortgageValue: 30},
-// }
 //
 // const UtilityPrice int32 = 150
 // const UtilityRentMult = [2]int32{4, 10}
@@ -88,9 +25,6 @@ var (
 //     {Name: "Short Line", Mortgaged: false},
 // }
 //
-// var Go = [1]Go{
-//     {Name: "Go", Salary: 200},
-// }
 //
 // var Chest = [3]Chest{
 //     {Name: "Community Chest"},
index 92d689733d456959309c87c5571ab878fa45fba2..fa651f45f8b4222d688c9a1f526e307afbfd44a2 100644 (file)
@@ -3,51 +3,137 @@ package game
 const BoardSpaces = 40
 
 var BoardSpaceTypes = [BoardSpaces]PropertyType{
-       0:  TypeGo,
-       1:  TypeColor,
-       2:  TypeChest,
-       3:  TypeColor,
-       4:  TypeTax,
-       5:  TypeRailroad,
-       6:  TypeColor,
-       7:  TypeChance,
-       8:  TypeColor,
-       9:  TypeColor,
-       10: TypeJail,
-       11: TypeColor,
-       12: TypeUtility,
-       13: TypeColor,
-       14: TypeColor,
-       15: TypeRailroad,
-       16: TypeColor,
-       17: TypeChest,
-       18: TypeColor,
-       19: TypeColor,
-       20: TypeParking,
-       21: TypeColor,
-       22: TypeChance,
-       23: TypeColor,
-       24: TypeColor,
-       25: TypeRailroad,
-       26: TypeColor,
-       27: TypeColor,
-       28: TypeUtility,
-       29: TypeColor,
-       30: TypeJail,
-       31: TypeColor,
-       32: TypeColor,
-       33: TypeChest,
-       34: TypeColor,
-       35: TypeRailroad,
-       36: TypeChance,
-       37: TypeColor,
-       38: TypeTax,
-       39: TypeColor,
+       TypeGo,
+       TypeColor,
+       TypeChest,
+       TypeColor,
+       TypeTax,
+       TypeRailroad,
+       TypeColor,
+       TypeChance,
+       TypeColor,
+       TypeColor,
+       TypeJail,
+       TypeColor,
+       TypeUtility,
+       TypeColor,
+       TypeColor,
+       TypeRailroad,
+       TypeColor,
+       TypeChest,
+       TypeColor,
+       TypeColor,
+       TypeParking,
+       TypeColor,
+       TypeChance,
+       TypeColor,
+       TypeColor,
+       TypeRailroad,
+       TypeColor,
+       TypeColor,
+       TypeUtility,
+       TypeColor,
+       TypeJail,
+       TypeColor,
+       TypeColor,
+       TypeChest,
+       TypeColor,
+       TypeRailroad,
+       TypeChance,
+       TypeColor,
+       TypeTax,
+       TypeColor,
+}
+
+type PropertyStatic struct {
+       Name  string
+       Price int32
+}
+
+var ColorProperties = []PropertyStatic{
+       {Name: "Mediterranean Avenue", Price: 60},
+       {Name: "Baltic Avenue", Price: 60},
+       {Name: "Oriental Avenue", Price: 100},
+       {Name: "Vermont Avenue", Price: 100},
+       {Name: "Connecticut Avenue", Price: 120},
+       {Name: "St. Charles Place", Price: 140},
+       {Name: "States Avenue", Price: 160},
+       {Name: "Virginia Avenue", Price: 140},
+       {Name: "St. James Place", Price: 180},
+       {Name: "Tennessee Avenue", Price: 200},
+       {Name: "Kentucky Avenue", Price: 220},
+       {Name: "Indiana Avenue", Price: 220},
+       {Name: "Illinois Avenue", Price: 240},
+       {Name: "Atlantic Avenue", Price: 260},
+       {Name: "Ventnor Avenue", Price: 260},
+       {Name: "Marvin Gardens", Price: 280},
+       {Name: "Pacific Avenue", Price: 300},
+       {Name: "North Carolina Avenue", Price: 300},
+       {Name: "Pennsylvania Avenue", Price: 320},
+       {Name: "Park Place", Price: 350},
+       {Name: "Boardwalk", Price: 400},
+}
+
+var RailroadProperties = []PropertyStatic{
+       {Name: "Reading Railroad", Price: 200},
+       {Name: "Pennsylvania Railroad", Price: 200},
+       {Name: "B.&O. Railroad", Price: 200},
+       {Name: "Short Line", Price: 200},
+}
+
+var UtilityProperties = []PropertyStatic{
+       {Name: "Electric Company", Price: 150},
+       {Name: "Waterworks", Price: 150},
+}
+
+type TaxSpace struct {
+       Name   string
+       Amount int32
+}
+
+var TaxSpaces = []TaxSpace{
+       {Name: "Income Tax", Amount: 200},
+       {Name: "Luxury Tax", Amount: 100},
+}
+
+var PropertyOwners = []int32{}
+
+var SpaceToOwnableProperty = make(map[int]int)
+var SpaceToTaxSpace = make(map[int]int)
+
+func init() {
+       colorIndex := 0
+       railroadIndex := 0
+       utilityIndex := 0
+       taxIndex := 0
+       for i, propertyType := range BoardSpaceTypes {
+               switch propertyType {
+               case TypeColor:
+                       SpaceToOwnableProperty[i] = colorIndex
+                       colorIndex++
+               case TypeRailroad:
+                       SpaceToOwnableProperty[i] = railroadIndex
+                       railroadIndex++
+               case TypeUtility:
+                       SpaceToOwnableProperty[i] = utilityIndex
+                       utilityIndex++
+               case TypeTax:
+                       SpaceToTaxSpace[i] = taxIndex
+                       taxIndex++
+               }
+
+       }
+
+}
+
+type ColorVisitor struct {
+       playerID int32
+       spaceID  int32
 }
 
 var (
        GoVisitors       []int32
-       ColorVisitors    []int32
+       ColorVisitors    []ColorVisitor
        ChestVisitors    []int32
        TaxVisitors      []int32
        RailroadVisitors []int32
@@ -71,7 +157,7 @@ func AdvancePlayer(playerID int32, currentPosition int32, diceRoll int32) {
        case TypeGo:
                GoVisitors = append(GoVisitors, playerID)
        case TypeColor:
-               ColorVisitors = append(ColorVisitors, playerID)
+               ColorVisitors = append(ColorVisitors, ColorVisitor{playerID: playerID, spaceID: nextPos})
        case TypeChest:
                ChestVisitors = append(ChestVisitors, playerID)
        case TypeTax:
index b998cdc978e103aa4cd7fd7e676f9e47a6dd3551..7e756392cbd1e6f2b65f9ec91c81cc507359e9f6 100644 (file)
@@ -19,11 +19,3 @@ const (
        TypeParking
        TypePolice
 )
-
-type Color struct {
-       Name          string
-       Price         int32
-       Mortgaged     bool
-       Rent          [6]int32
-       MortgageValue int32
-}