Compare commits
No commits in common. "34f35882c158ad145400639ac93db63943cb33ee" and "6616a891384cc8c61b64e48ed33a4d5030263f2d" have entirely different histories.
34f35882c1
...
6616a89138
|
@ -1,6 +1,7 @@
|
||||||
package opponent
|
package opponent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math"
|
||||||
"tictactoe/gameControl"
|
"tictactoe/gameControl"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ func Minimax(board [3][3]string, depth int, isMaximizingPlayer bool, player stri
|
||||||
// check who's turn it is
|
// check who's turn it is
|
||||||
if isMaximizingPlayer {
|
if isMaximizingPlayer {
|
||||||
// set max score
|
// set max score
|
||||||
bestScore := -10000
|
bestScore := math.MinInt64
|
||||||
var bestMove NextMove
|
var bestMove NextMove
|
||||||
// iterate through all fields
|
// iterate through all fields
|
||||||
for i := 0; i < 3; i++ {
|
for i := 0; i < 3; i++ {
|
||||||
|
@ -48,7 +49,7 @@ func Minimax(board [3][3]string, depth int, isMaximizingPlayer bool, player stri
|
||||||
return bestMove
|
return bestMove
|
||||||
} else {
|
} else {
|
||||||
// set min score
|
// set min score
|
||||||
bestScore := 10000
|
bestScore := math.MaxInt64
|
||||||
var bestMove NextMove
|
var bestMove NextMove
|
||||||
// iterate through all fields
|
// iterate through all fields
|
||||||
for i := 0; i < 3; i++ {
|
for i := 0; i < 3; i++ {
|
||||||
|
|
Loading…
Reference in New Issue