generated from fmartingr/golang-app-template
models
This commit is contained in:
parent
7b9f034527
commit
3a71ba912a
2
go.mod
2
go.mod
|
@ -1,3 +1,5 @@
|
|||
module code.fmartingr.dev/fmartingr/ichi
|
||||
|
||||
go 1.19
|
||||
|
||||
require github.com/google/uuid v1.3.0
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
|
@ -0,0 +1,74 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const MaxPlayers = 4
|
||||
|
||||
type ID uuid.UUID
|
||||
type PlayerPhase int
|
||||
type CardNumber int
|
||||
type CardColor int
|
||||
type CardSpecial int
|
||||
|
||||
const (
|
||||
PlayerPhaseWaiting = iota
|
||||
PlayerPhaseTurn
|
||||
PlayerPhaseDraw
|
||||
PlayerPhasePlay
|
||||
PlayerPhaseIchi
|
||||
PlayerPhasePass
|
||||
)
|
||||
|
||||
const (
|
||||
CardColorRed = iota
|
||||
CardColorBlue
|
||||
CardColorGreen
|
||||
CardColorYellow
|
||||
)
|
||||
|
||||
const (
|
||||
CardSpecialPlus2 = iota
|
||||
CardSpecialPlus4
|
||||
CardSpecialReverseTurn
|
||||
CardSpecialColorChange
|
||||
CardSpecialSkipTurn
|
||||
)
|
||||
|
||||
type Card struct {
|
||||
Color CardColor
|
||||
Number CardNumber
|
||||
Special CardSpecial
|
||||
}
|
||||
|
||||
type Player struct {
|
||||
ID ID
|
||||
Name string
|
||||
State *PlayerState
|
||||
Cards map[ID]*Card
|
||||
}
|
||||
|
||||
type Game struct {
|
||||
ID ID
|
||||
MaxPlayers int
|
||||
Players map[ID]*Player
|
||||
Cards list.List
|
||||
Stage GameStage
|
||||
History list.List
|
||||
}
|
||||
|
||||
type GameHistory struct {
|
||||
Player *Player
|
||||
Card *Card
|
||||
Action interface{}
|
||||
}
|
||||
|
||||
type GameStage struct {
|
||||
}
|
||||
|
||||
type PlayerState struct {
|
||||
Phase PlayerPhase
|
||||
}
|
Loading…
Reference in New Issue