37 lines
743 B
Go
37 lines
743 B
Go
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
|
|
}
|