DEV 1303: Add empty and royale maps and update game map interface (#72)
* move random generator into Settings * add empty and royale maps * place snakes on either cardinal or corner positions first
This commit is contained in:
parent
6fa2da2f01
commit
e94d758a9b
12 changed files with 479 additions and 52 deletions
|
|
@ -24,9 +24,6 @@ type Metadata struct {
|
|||
|
||||
// Editor is used by GameMap implementations to modify the board state.
|
||||
type Editor interface {
|
||||
// Returns a random number generator. This MUST be used for any non-deterministic behavior in a GameMap.
|
||||
Random() rules.Rand
|
||||
|
||||
// Clears all food from the board.
|
||||
ClearFood()
|
||||
|
||||
|
|
@ -52,18 +49,14 @@ type Editor interface {
|
|||
// An Editor backed by a BoardState.
|
||||
type BoardStateEditor struct {
|
||||
*rules.BoardState
|
||||
rand rules.Rand
|
||||
}
|
||||
|
||||
func NewBoardStateEditor(boardState *rules.BoardState, rand rules.Rand) *BoardStateEditor {
|
||||
func NewBoardStateEditor(boardState *rules.BoardState) *BoardStateEditor {
|
||||
return &BoardStateEditor{
|
||||
BoardState: boardState,
|
||||
rand: rand,
|
||||
}
|
||||
}
|
||||
|
||||
func (editor *BoardStateEditor) Random() rules.Rand { return editor.rand }
|
||||
|
||||
func (editor *BoardStateEditor) ClearFood() {
|
||||
editor.Food = []rules.Point{}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue