stub state
This commit is contained in:
36
game/state/state.go
Normal file
36
game/state/state.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package state
|
||||
|
||||
type State struct {
|
||||
Players []PlayerState
|
||||
Cards []CardState
|
||||
}
|
||||
|
||||
func (state State) Copy() State {
|
||||
return State{
|
||||
Players: append([]PlayerState{}, state.Players...),
|
||||
Cards: append([]CardState{}, state.Cards...),
|
||||
}
|
||||
}
|
||||
|
||||
func (state State) RedactLiberal() State {
|
||||
return state.Redact(LIBERAL)
|
||||
}
|
||||
|
||||
func (state State) RedactFacist() State {
|
||||
return state.Redact(FACIST)
|
||||
}
|
||||
|
||||
func (state State) RedactHitler() State {
|
||||
return state.Redact(HITLER)
|
||||
}
|
||||
|
||||
func (state State) Redact(alignment Alignment) State {
|
||||
state2 := state.Copy()
|
||||
for i := range state2.Players {
|
||||
state2.Players[i] = state2.Players[i].Redact(alignment)
|
||||
}
|
||||
for i := range state2.Cards {
|
||||
state2.Cards[i] = state2.Cards[i].Redact(alignment)
|
||||
}
|
||||
return state2
|
||||
}
|
||||
Reference in New Issue
Block a user