This commit is contained in:
Felipe M 2024-03-13 18:42:39 +01:00
parent 7b9f034527
commit 3a71ba912a
3 changed files with 78 additions and 0 deletions

2
go.mod
View File

@ -1,3 +1,5 @@
module code.fmartingr.dev/fmartingr/ichi
go 1.19
require github.com/google/uuid v1.3.0

2
go.sum Normal file
View File

@ -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=

74
internal/models/models.go Normal file
View File

@ -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
}