-
Notifications
You must be signed in to change notification settings - Fork 1
/
game.go
77 lines (59 loc) · 1.91 KB
/
game.go
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package gridspech
//go:generate stringer -type=TileType -linecomment -output=stringers.go
const (
// TypeHole represents a tile which does not exist. They cannot have Color.
TypeHole TileType = iota // _
// TypeBlank is a tile which does not have any icons.
TypeBlank // Blank
// TypeGoal is a tile which must have a direct path to another goal.
TypeGoal // Goal
// TypeCrown tiles must touch all tiles of their state.
// If there are multiple crowns on the same state, they must not not touch each other, and
// together they must touch all tiles of their state.
TypeCrown // Crown
// TypeDot1 must be touching exactly 1 tiles with Color >= 1.
TypeDot1 // Dot1
// TypeDot2 must be touching exactly 2 tiles with Color >= 1.
TypeDot2 // Dot2
// TypeDot3 must be touching exactly 3 tiles with Color >= 1.
TypeDot3 // Dot3
// TypeJoin1 must touch exactly 1 tile with a non-blank type.
TypeJoin1 // Join1
// TypeJoin2 must touch exactly 1 tile with a non-blank type.
TypeJoin2 // Join2
)
// Constants for TileColor
const (
ColorNone TileColor = iota // _
ColorA // A
ColorB // B
)
// TileColor represents if a tile is disabled (0), or has a color (> 0, different colors have increasing numbers).
type TileColor byte
// TileType represents what kind of tile it is, ie "what icon to display on it".
type TileType byte
// Grid represents a single level of gridspech.
type Grid struct {
Tiles [][]Tile
MaxColors int
}
// TileCoord is an X,Y coordinate in the grid.
type TileCoord struct {
X, Y int
}
// TileData represents all of the properties which a tile can have.
type TileData struct {
Color TileColor
Type TileType
Sticky bool
ArrowNorth bool
ArrowEast bool
ArrowSouth bool
ArrowWest bool
}
// Tile represents a tile in the game of gridspech. The default value of a tile will have
// `Type = Hole`.
type Tile struct {
Coord TileCoord
Data TileData
}