Fix legal move calculation

This commit is contained in:
Trevor Slocum 2023-09-30 15:21:59 -07:00
parent db3870b9fe
commit 0bfb03f767

View file

@ -417,14 +417,12 @@ func (g *Game) LegalMoves() [][]int {
}
// Move normally.
dir := -1
lastSpace := 1
if g.Turn == 2 {
dir = 1
lastSpace = 24
}
g.iterateSpaces(space+dir, lastSpace, func(to int, spaceCount int) {
g.iterateSpaces(space, lastSpace, func(to int, spaceCount int) {
available := haveDiceRoll(space, to)
if available == 0 {
return