mchess-server/chess/knight.go

22 lines
472 B
Go
Raw Normal View History

package chess
2023-06-27 20:32:24 +00:00
import (
"mchess_server/types"
)
type Knight struct {
Color types.ChessColor
}
2023-06-27 20:32:24 +00:00
func (k Knight) GetAllAttackedSquares(board Board, fromSquare types.Coordinate) []types.Coordinate {
return k.GetAllNonBlockedMoves(board, fromSquare)
}
func (k Knight) GetColor() types.ChessColor {
return k.Color
}
2023-06-27 20:32:24 +00:00
func (k Knight) GetAllNonBlockedMoves(board Board, fromSquare types.Coordinate) []types.Coordinate {
return board.GetNonBlockedKnightMoves(fromSquare)
}