Skip to content

Commit

Permalink
fix: always moves 2 square left or right when castling
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielg2020 committed Nov 12, 2024
1 parent 681d87c commit 5bd5686
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/service/move_service/move_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func getCastlingMoves(piece int, fromY int, fromX int, chessboard entity.Chessbo
kingSideX, queenSideX = fromX+2, fromX-2
} else {
kingSideRight, queenSideRight = 'k', 'q'
kingSideX, queenSideX = fromX-2, fromX+3
kingSideX, queenSideX = fromX-2, fromX+2
}

// King Side Castling
Expand Down
2 changes: 1 addition & 1 deletion api/service/move_service/move_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func Test_MoveService_getCastlingMoves(t *testing.T) {
},
expectedMoves: []entity.MoveEntityInterface{
newMockMoveEntity(4, 0, 2, 0, 0, true, false, 0),
newMockMoveEntity(4, 0, 7, 0, 0, true, false, 0),
newMockMoveEntity(4, 0, 6, 0, 0, true, false, 0),
},
expectedError: nil,
},
Expand Down

0 comments on commit 5bd5686

Please sign in to comment.