Skip to content

Commit

Permalink
Go fmt entire project
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshochadel committed Mar 13, 2021
1 parent 1941525 commit 8176d81
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion engines/minimax.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/notnil/chess"
)

type MinimaxEngine struct {}
type MinimaxEngine struct{}

// SuggestedMove calculates the most advantageous move for the player. It currently works
// synchronously, but can probably be made concurrent with goroutines.
Expand Down
46 changes: 23 additions & 23 deletions engines/minimax_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import (
)

func TestEvaluatePosition(t *testing.T) {
cases := []struct{
Name string
FEN string
cases := []struct {
Name string
FEN string
Expected float64
}{
{ "starting position", "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 0.0 },
{ "black missing pawn", "rnbqkbnr/ppppppp1/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 1.0 },
{ "white missing pawn", "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPP1/RNBQKBNR w KQkq - 0 1", -1.0 },
{ "black no pawns", "rnbqkbnr/8/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 8.0 },
{ "black missing bishop", "rn1qkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 3.0 },
{ "black missing knight", "r1bqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 3.0 },
{ "black missing rook", "1nbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 6.0 },
{ "black missing queen", "rnb1kbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 9.0 },
{"starting position", "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 0.0},
{"black missing pawn", "rnbqkbnr/ppppppp1/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 1.0},
{"white missing pawn", "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPP1/RNBQKBNR w KQkq - 0 1", -1.0},
{"black no pawns", "rnbqkbnr/8/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 8.0},
{"black missing bishop", "rn1qkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 3.0},
{"black missing knight", "r1bqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 3.0},
{"black missing rook", "1nbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 6.0},
{"black missing queen", "rnb1kbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", 9.0},
}
for _, tc := range cases {
t.Run(fmt.Sprintf("%v: %v + %v", tc.Name, tc.FEN, tc.Expected), func(t *testing.T) {
Expand All @@ -35,26 +35,26 @@ func TestEvaluatePosition(t *testing.T) {
if actual != tc.Expected {
t.Fatalf("expected %v, got %v", tc.Expected, actual)
}
})
})
}
}

func TestMinimax(t *testing.T) {

}

func TestBest(t *testing.T) {
cases := []struct {
Name string
Name string
Comparator func(float64, float64) float64
A *positionScore
B *positionScore
A *positionScore
B *positionScore
ExpectingA bool
}{
{
"Max, A == B",
math.Max,
&positionScore {
&positionScore{
value: 0.0,
},
&positionScore{
Expand All @@ -65,7 +65,7 @@ func TestBest(t *testing.T) {
{
"Max, A > B",
math.Max,
&positionScore {
&positionScore{
value: 1.0,
},
&positionScore{
Expand All @@ -76,7 +76,7 @@ func TestBest(t *testing.T) {
{
"Max, A < B",
math.Max,
&positionScore {
&positionScore{
value: 0.0,
},
&positionScore{
Expand All @@ -87,7 +87,7 @@ func TestBest(t *testing.T) {
{
"Min, A == B",
math.Min,
&positionScore {
&positionScore{
value: 0.0,
},
&positionScore{
Expand All @@ -98,7 +98,7 @@ func TestBest(t *testing.T) {
{
"Min, A > B",
math.Min,
&positionScore {
&positionScore{
value: 1.0,
},
&positionScore{
Expand All @@ -109,7 +109,7 @@ func TestBest(t *testing.T) {
{
"Min, A < B",
math.Min,
&positionScore {
&positionScore{
value: 0.0,
},
&positionScore{
Expand All @@ -122,7 +122,7 @@ func TestBest(t *testing.T) {
t.Run(fmt.Sprintf("%v", tc.Name), func(t *testing.T) {
actual := best(tc.Comparator, tc.A, tc.B)
if tc.ExpectingA && actual != tc.A {
t.Fatalf("expected A, got B", )
t.Fatalf("expected A, got B")
} else if !tc.ExpectingA && actual == tc.A {
t.Fatalf("expected B, got B")
}
Expand Down
2 changes: 1 addition & 1 deletion scratch/stockfish_vs_stockfish.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package stockfishvs
import (
"fmt"
"time"

"github.com/notnil/chess"
"github.com/notnil/chess/uci"
)
Expand Down

0 comments on commit 8176d81

Please sign in to comment.