-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpiece.go
59 lines (50 loc) · 880 Bytes
/
piece.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
package pawn
type Material uint8
const (
Pawn Material = iota + 1
Rook
Bishop
Knight
Queen
King
)
var materialNames = map[Material]string{
Pawn: "",
Rook: "R",
Bishop: "B",
Knight: "N",
Queen: "Q",
King: "K",
}
// N.B. The unicode for black is used for white and visa versa
// because against a terminal window black looks white and white looks
// black
var materialFigurines = map[Color]map[Material]string{
White: map[Material]string{
Pawn: "♟",
Rook: "♜",
Bishop: "♝",
Knight: "♞",
Queen: "♛",
King: "♚",
},
Black: map[Material]string{
Pawn: "♙",
Rook: "♖",
Bishop: "♗",
Knight: "♘",
Queen: "♕",
King: "♔",
},
}
type Color string
const (
Black Color = "Black"
White Color = "White"
)
var colors = [2]Color{White, Black}
type Piece struct {
Color
Material
}
var NoPiece = Piece{}