mchess-server/chess/knight.go
Marco af993876fd Introduce check if the game has ended (checkmate/stalemate)
Introduce checkmate check and send out 'gameEnded' message
2024-01-17 23:06:48 +01:00

24 lines
555 B
Go

package chess
import (
"mchess_server/types"
)
type Knight struct {
Color types.ChessColor
}
func (n Knight) GetAllAttackedSquares(board Board, fromSquare types.Coordinate) []types.Coordinate {
return n.GetAllNonBlockedSquares(board, fromSquare)
}
func (n Knight) GetColor() types.ChessColor {
return n.Color
}
func (n Knight) GetAllNonBlockedSquares(board Board, fromSquare types.Coordinate) []types.Coordinate {
return board.GetNonBlockedKnightMoves(fromSquare)
}
func (n Knight) AfterMoveAction(board *Board, fromSquare types.Coordinate) {}