Rename models.go to ruleset.go
This commit is contained in:
parent
11e5735109
commit
d477201b1e
1 changed files with 0 additions and 0 deletions
37
ruleset.go
Normal file
37
ruleset.go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package rulesets
|
||||
|
||||
const (
|
||||
MOVE_UP = "up"
|
||||
MOVE_DOWN = "down"
|
||||
MOVE_RIGHT = "right"
|
||||
MOVE_LEFT = "left"
|
||||
)
|
||||
|
||||
type Point struct {
|
||||
X int32
|
||||
Y int32
|
||||
}
|
||||
|
||||
type Snake struct {
|
||||
ID string
|
||||
Body []*Point
|
||||
Health int32
|
||||
EliminatedCause string
|
||||
}
|
||||
|
||||
type BoardState struct {
|
||||
Height int32
|
||||
Width int32
|
||||
Food []*Point
|
||||
Snakes []*Snake
|
||||
}
|
||||
|
||||
type SnakeMove struct {
|
||||
Snake *Snake
|
||||
Move string
|
||||
}
|
||||
|
||||
type Ruleset interface {
|
||||
CreateInitialBoardState(width int32, height int32, snakeIDs []string) (*BoardState, error)
|
||||
ResolveMoves(prevState *BoardState, moves []*SnakeMove) (*BoardState, error)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue