Skip to content

Commit 055d8a1

Browse files
author
David Linus Briemann
committed
summer cleanup
1 parent f48fad1 commit 055d8a1

File tree

4 files changed

+51
-52
lines changed

4 files changed

+51
-52
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ clean:
88
rm chesskimo bench
99

1010
debug:
11-
go build -o chesskimo -i -v -ldflags="-X main.version=$(shell git describe --always)" $(PACKAGE)/chesskimo
12-
go build -o bench -i -v -ldflags="-X main.version=$(shell git describe --always)" $(PACKAGE)/bench
11+
go build -o chesskimo -v -ldflags="-X main.version=$(shell git describe --always)" $(PACKAGE)/chesskimo
12+
go build -o bench -v -ldflags="-X main.version=$(shell git describe --always)" $(PACKAGE)/bench
1313

1414
release:
15-
go build -o chesskimo -i -v -gcflags="-B" -ldflags="-X main.version=$(shell git describe --always)" $(PACKAGE)/chesskimo
16-
go build -o bench -i -v -gcflags="-B" -ldflags="-X main.version=$(shell git describe --always)" $(PACKAGE)/bench
15+
go build -o chesskimo -v -gcflags="-B" -ldflags="-X main.version=$(shell git describe --always)" $(PACKAGE)/chesskimo
16+
go build -o bench -v -gcflags="-B" -ldflags="-X main.version=$(shell git describe --always)" $(PACKAGE)/bench
1717

1818
profile:
1919
./bench -profile=prof.out

board_test.go

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,18 @@ import (
1212
// to /cmd/bench which is ~10% slower with go1.10.
1313
//
1414
// TODO -> What's going on here?
15-
//
1615
func BenchmarkPerft(b *testing.B) {
1716
type set struct {
1817
Fen string
1918
Depth int
2019
Result uint64
2120
}
2221
testsets := []set{
23-
set{Fen: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", Depth: 6, Result: 119060324},
24-
set{Fen: "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1", Depth: 5, Result: 193690690},
25-
set{Fen: "n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - - 0 1", Depth: 6, Result: 71179139},
26-
set{Fen: "r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1", Depth: 5, Result: 15833292},
27-
set{Fen: "8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 0", Depth: 7, Result: 178633661},
22+
{Fen: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", Depth: 6, Result: 119060324},
23+
{Fen: "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1", Depth: 5, Result: 193690690},
24+
{Fen: "n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - - 0 1", Depth: 6, Result: 71179139},
25+
{Fen: "r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1", Depth: 5, Result: 15833292},
26+
{Fen: "8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 0", Depth: 7, Result: 178633661},
2827
}
2928

3029
board := NewBoard()
@@ -84,23 +83,23 @@ func TestSquareDiffs(t *testing.T) {
8483
}
8584

8685
testset := []set{
87-
set{0x72, 0x12, ROOK | QUEEN}, // file test down to up
88-
set{0x12, 0x72, ROOK | QUEEN}, // file test up to down
89-
set{0x51, 0x54, ROOK | QUEEN}, // rank test left to right
90-
set{0x54, 0x51, ROOK | QUEEN}, // rank test right to left
91-
set{0x64, 0x37, BISHOP | QUEEN}, // diagonal up_left to down_right test
92-
set{0x37, 0x64, BISHOP | QUEEN}, // diagonal down_right to up_left test
93-
set{0x77, 0x0, BISHOP | QUEEN}, // diagonal up_right to down_left test
94-
set{0x0, 0x77, BISHOP | QUEEN}, // diagonal down_left to up_right test
95-
set{0x0, 0x12, KNIGHT}, // knight jump right+up_right
96-
set{0x0, 0x21, KNIGHT}, // knight jump up+up_right
97-
set{0x77, 0x56, KNIGHT}, // knight jump down+down_left
98-
set{0x77, 0x65, KNIGHT}, // knight jump left+down_left
99-
set{0x74, 0x65, KING | QUEEN | BISHOP}, // one step diagonal (king test)
100-
set{0x4, 0x5, KING | QUEEN | ROOK}, // one step orthogonal (king test)
86+
{0x72, 0x12, ROOK | QUEEN}, // file test down to up
87+
{0x12, 0x72, ROOK | QUEEN}, // file test up to down
88+
{0x51, 0x54, ROOK | QUEEN}, // rank test left to right
89+
{0x54, 0x51, ROOK | QUEEN}, // rank test right to left
90+
{0x64, 0x37, BISHOP | QUEEN}, // diagonal up_left to down_right test
91+
{0x37, 0x64, BISHOP | QUEEN}, // diagonal down_right to up_left test
92+
{0x77, 0x0, BISHOP | QUEEN}, // diagonal up_right to down_left test
93+
{0x0, 0x77, BISHOP | QUEEN}, // diagonal down_left to up_right test
94+
{0x0, 0x12, KNIGHT}, // knight jump right+up_right
95+
{0x0, 0x21, KNIGHT}, // knight jump up+up_right
96+
{0x77, 0x56, KNIGHT}, // knight jump down+down_left
97+
{0x77, 0x65, KNIGHT}, // knight jump left+down_left
98+
{0x74, 0x65, KING | QUEEN | BISHOP}, // one step diagonal (king test)
99+
{0x4, 0x5, KING | QUEEN | ROOK}, // one step orthogonal (king test)
101100
// impossible moves
102-
set{0x0, 0x71, NONE},
103-
set{0x5, 0x36, NONE},
101+
{0x0, 0x71, NONE},
102+
{0x5, 0x36, NONE},
104103
}
105104

106105
for i, ts := range testset {
@@ -120,22 +119,22 @@ func TestDiffDirs(t *testing.T) {
120119
}
121120

122121
testset := []set{
123-
set{0x70, 0x07, DOWN_RIGHT},
124-
set{0x47, 0x65, UP_LEFT},
125-
set{0x77, 0x11, DOWN_LEFT},
126-
set{0x24, 0x46, UP_RIGHT},
127-
set{0x61, 0x66, RIGHT},
128-
set{0x33, 0x30, LEFT},
129-
set{0x22, 0x62, UP},
130-
set{0x55, 0x25, DOWN},
131-
set{0x00, 0x12, RIGHT + UP_RIGHT},
132-
set{0x00, 0x21, UP + UP_RIGHT},
133-
set{0x70, 0x62, RIGHT + DOWN_RIGHT},
134-
set{0x70, 0x51, DOWN + DOWN_RIGHT},
135-
set{0x77, 0x65, LEFT + DOWN_LEFT},
136-
set{0x77, 0x56, DOWN + DOWN_LEFT},
137-
set{0x07, 0x15, LEFT + UP_LEFT},
138-
set{0x07, 0x26, UP + UP_LEFT},
122+
{0x70, 0x07, DOWN_RIGHT},
123+
{0x47, 0x65, UP_LEFT},
124+
{0x77, 0x11, DOWN_LEFT},
125+
{0x24, 0x46, UP_RIGHT},
126+
{0x61, 0x66, RIGHT},
127+
{0x33, 0x30, LEFT},
128+
{0x22, 0x62, UP},
129+
{0x55, 0x25, DOWN},
130+
{0x00, 0x12, RIGHT + UP_RIGHT},
131+
{0x00, 0x21, UP + UP_RIGHT},
132+
{0x70, 0x62, RIGHT + DOWN_RIGHT},
133+
{0x70, 0x51, DOWN + DOWN_RIGHT},
134+
{0x77, 0x65, LEFT + DOWN_LEFT},
135+
{0x77, 0x56, DOWN + DOWN_LEFT},
136+
{0x07, 0x15, LEFT + UP_LEFT},
137+
{0x07, 0x26, UP + UP_LEFT},
139138
}
140139

141140
for i, ts := range testset {

cmd/chesskimo/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ func main() {
1515
fmt.Println("Chesskimo", version)
1616

1717
uci := &chesskimo.UCI{}
18-
engine := chesskimo.NewEngine("Chesskimo "+version+" 2018", "David Linus Briemann", uci, chesskimo.SimpleMCSearch)
19-
// engine := chesskimo.NewEngine("Chesskimo "+version+" 2019", "David Linus Briemann", uci, chesskimo.AlphaBetaSearch)
18+
engine := chesskimo.NewEngine("Chesskimo "+version+" 2022", "David Linus Briemann", uci, chesskimo.SimpleMCSearch)
19+
// engine := chesskimo.NewEngine("Chesskimo "+version+" 2022", "David Linus Briemann", uci, chesskimo.AlphaBetaSearch)
2020

2121
// Input/output runs until exit.
2222
engine.Run()

fen_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ func TestParseColor(t *testing.T) {
8686
// TestParseCastlingRights tests if the ParseCastlingRights function behaves correctly.
8787
func TestParseCastlingRights(t *testing.T) {
8888
tests := map[string][][2]bool{
89-
"KkQq": [][2]bool{[2]bool{true, true}, [2]bool{true, true}},
90-
"KQq": [][2]bool{[2]bool{false, true}, [2]bool{true, true}},
91-
"kQq": [][2]bool{[2]bool{true, false}, [2]bool{true, true}},
92-
"Kkq": [][2]bool{[2]bool{true, true}, [2]bool{true, false}},
93-
"KkQ": [][2]bool{[2]bool{true, true}, [2]bool{false, true}},
94-
"Kk": [][2]bool{[2]bool{true, true}, [2]bool{false, false}},
95-
"Qq": [][2]bool{[2]bool{false, false}, [2]bool{true, true}},
96-
"-": [][2]bool{[2]bool{false, false}, [2]bool{false, false}},
89+
"KkQq": {{true, true}, {true, true}},
90+
"KQq": {{false, true}, {true, true}},
91+
"kQq": {{true, false}, {true, true}},
92+
"Kkq": {{true, true}, {true, false}},
93+
"KkQ": {{true, true}, {false, true}},
94+
"Kk": {{true, true}, {false, false}},
95+
"Qq": {{false, false}, {true, true}},
96+
"-": {{false, false}, {false, false}},
9797
}
9898

9999
for s, r := range tests {

0 commit comments

Comments
 (0)