Refactoring evaluate_test
[?]
Dec 28, 2020, 4:45 PM
2DRAL6A256OELKDGOGBXQ2VLLIEKKKZ4VEV3O26QP7JJN32SB3IQCDependencies
- [2]
HSJSKGY7Refactoring evaluate functions - [3]
G5KXCVILtictactoe: initial import - [4]
UWVAMBIJFix couple of tests, add more - [5]
TYELLGSARename checkDiag to checkDiagLR and add checkDiagRL. Add more tests
Change contents
- replacement in snippets/tictactoe/evaluate_test.go at line 1
package tictactoepackage tictactoe_test - edit in snippets/tictactoe/evaluate_test.go at line 5
"tictactoe" - replacement in snippets/tictactoe/evaluate_test.go at line 13
board Boardboard tictactoe.Board - replacement in snippets/tictactoe/evaluate_test.go at line 16
{"Nothing", [][]rune{{Pl1, Pl1, Pl2}, {Empty, Empty, Empty}, {Empty, Empty, Empty}}, 0},{"Pl1 row", [][]rune{{Pl1, Pl1, Pl1}, {Empty, Empty, Empty}, {Empty, Empty, Empty}}, 10},{"Pl2 col", [][]rune{{Pl2, Empty, Empty}, {Pl2, Empty, Empty}, {Pl2, Empty, Empty}}, -10},{"Pl1 last col", [][]rune{{Empty, Empty, Pl1}, {Empty, Empty, Pl1}, {Empty, Empty, Pl1}}, 10},{"Pl2 diag lr", [][]rune{{Pl2, Empty, Empty}, {Empty, Pl2, Empty}, {Empty, Empty, Pl2}}, -10},{"Pl1 diag rl", [][]rune{{Empty, Empty, Pl1}, {Empty, Pl1, Empty}, {Pl1, Empty, Empty}}, 10},{"Nothing", tictactoe.Board{{tictactoe.Pl1, tictactoe.Pl1, tictactoe.Pl2}, {tictactoe.Empty, tictactoe.Empty, tictactoe.Empty}, {tictactoe.Empty, tictactoe.Empty, tictactoe.Empty}}, 0},{"tictactoe.Pl1 row", tictactoe.Board{{tictactoe.Pl1, tictactoe.Pl1, tictactoe.Pl1}, {tictactoe.Empty, tictactoe.Empty, tictactoe.Empty}, {tictactoe.Empty, tictactoe.Empty, tictactoe.Empty}}, 10},{"tictactoe.Pl2 col", tictactoe.Board{{tictactoe.Pl2, tictactoe.Empty, tictactoe.Empty}, {tictactoe.Pl2, tictactoe.Empty, tictactoe.Empty}, {tictactoe.Pl2, tictactoe.Empty, tictactoe.Empty}}, -10},{"tictactoe.Pl1 last col", tictactoe.Board{{tictactoe.Empty, tictactoe.Empty, tictactoe.Pl1}, {tictactoe.Empty, tictactoe.Empty, tictactoe.Pl1}, {tictactoe.Empty, tictactoe.Empty, tictactoe.Pl1}}, 10},{"tictactoe.Pl2 diag lr", tictactoe.Board{{tictactoe.Pl2, tictactoe.Empty, tictactoe.Empty}, {tictactoe.Empty, tictactoe.Pl2, tictactoe.Empty}, {tictactoe.Empty, tictactoe.Empty, tictactoe.Pl2}}, -10},{"tictactoe.Pl1 diag rl", tictactoe.Board{{tictactoe.Empty, tictactoe.Empty, tictactoe.Pl1}, {tictactoe.Empty, tictactoe.Pl1, tictactoe.Empty}, {tictactoe.Pl1, tictactoe.Empty, tictactoe.Empty}}, 10}, - replacement in snippets/tictactoe/evaluate_test.go at line 25
assert.Equal(t, tc.expected, tc.board.evaluate())assert.Equal(t, tc.expected, tc.board.Evaluate()) - replacement in snippets/tictactoe/evaluate.go at line 3
func (b Board) evaluate() int {// Evaluate evaluates the Board for the minimax algorithm.func (b Board) Evaluate() int {