Fix calculating whether players may bear off

This commit is contained in:
Trevor Slocum 2023-11-19 17:55:37 -08:00
parent 5ccc3464fb
commit 44b1eb1fd3
3 changed files with 5 additions and 5 deletions

View file

@ -86,7 +86,7 @@ func CanBearOff(board []int, player int, local bool) bool {
homeStart, homeEnd = HomeRange(player)
homeStart, homeEnd = minInt(homeStart, homeEnd), maxInt(homeStart, homeEnd)
}
for i := 1; i < 24; i++ {
for i := 1; i <= 24; i++ {
if (i < homeStart || i > homeEnd) && PlayerCheckers(board[i], player) > 0 {
return false
}

View file

@ -1161,9 +1161,9 @@ COMMANDS:
}
clientGame.Turn = 1
clientGame.Roll1 = 1
clientGame.Roll2 = 2
clientGame.Board = []int{12, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, -12, 0, 0}
clientGame.Roll1 = 5
clientGame.Roll2 = 6
clientGame.Board = []int{1, 3, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 2, -12, 0, 0}
clientGame.eachClient(func(client *serverClient) {
clientGame.sendBoard(client)

View file

@ -278,7 +278,7 @@ ADDMOVES:
return false, nil
}
g.Board = gameCopy.Board
g.Board = append(g.Board[:0], gameCopy.Board...)
g.Moves = gameCopy.Moves
g.boardStates = gameCopy.boardStates