Files
Chess/main.go
MSWS 1b197dc642 fix: Restore and enhance move generation and board logic
- Enhance `testdata/integration_test.go` with improved logging and subtest naming for better clarity.
- Refine castle move legality checks in `board/move.go` to ensure accurate column-based validation.

[testdata/integration_test.go]
- Updated log statement in `testData` function to include both the description and FEN string.
- Modified subtest naming to replace slashes in the FEN string with periods.
[board/move.go]
- Adjusted conditional logic for castle-related moves to check for different column coordinates when determining legality.
- No functional changes outside of castle move handling.
2025-03-22 18:10:09 -07:00

29 lines
453 B
Go

package main
import (
"fmt"
"github.com/msws/chess/board"
)
func main() {
board, err := board.FromFEN("8/8/4k3/8/8/8/4p3/R3K2R w KQ - 0 1")
if err != nil {
panic(err)
}
baseMoves := board.GetMoves()
for _, move := range baseMoves {
board.MakeMove(move)
newMoves := board.GetMoves()
fmt.Printf("%v: %d moves\n", move, len(newMoves))
fmt.Println(newMoves)
board.UndoMove()
}
fmt.Printf("(%d) %v", len(baseMoves), baseMoves)
}