starter repo

This commit is contained in:
wagslane
2024-04-02 12:38:06 -06:00
parent d4a1dc9bdf
commit 4885f7a113
18 changed files with 624 additions and 1 deletions

View File

@@ -0,0 +1,52 @@
package gamelogic
type Player struct {
Username string
Units map[int]Unit
}
type UnitRank string
const (
RankInfantry = "infantry"
RankCavalry = "cavalry"
RankArtillery = "artillery"
)
type Unit struct {
ID int
Rank UnitRank
Location Location
}
type ArmyMove struct {
Player Player
Units []Unit
ToLocation Location
}
type RecognitionOfWar struct {
Attacker Player
Defender Player
}
type Location string
func getAllRanks() map[UnitRank]struct{} {
return map[UnitRank]struct{}{
RankInfantry: {},
RankCavalry: {},
RankArtillery: {},
}
}
func getAllLocations() map[Location]struct{} {
return map[Location]struct{}{
"americas": {},
"europe": {},
"africa": {},
"asia": {},
"australia": {},
"antarctica": {},
}
}