-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtypes.go
More file actions
45 lines (36 loc) · 1.04 KB
/
types.go
File metadata and controls
45 lines (36 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package gogo
import "time"
const (
// EmptyPosition is an empty spot on the board.
EmptyPosition = 0
// PlayerBlack indicates a position occupied by a black stone.
PlayerBlack = 1
// PlayerWhite indicates a position occupied by a white stone.
PlayerWhite = 2
// RulesFailureSpaceOccupied is the string displayed when a player attempts to play on an occupied spot.
RulesFailureSpaceOccupied = "Cannot perform move (%s), the target position is already occupied."
)
// GameBoard is a two-dimensional array of stones.
type GameBoard struct {
Positions [][]byte
}
// Match represents the state of an in-progress game of Go.
type Match struct {
TurnCount int
GridSize int
ID string
StartTime time.Time
GameBoard GameBoard
PlayerBlack string
PlayerWhite string
}
// Coordinate represents an x-y coordinate of an intersection on a Go board
type Coordinate struct {
X int
Y int
}
// Move represents an intent to perform a move by a player. Empty Position indicates a pass.
type Move struct {
Player byte
Position Coordinate
}