2023-06-20 21:53:54 +00:00
|
|
|
package chess
|
|
|
|
|
2023-06-27 20:32:24 +00:00
|
|
|
import (
|
|
|
|
"mchess_server/types"
|
|
|
|
)
|
2023-06-20 21:53:54 +00:00
|
|
|
|
|
|
|
type King struct {
|
2023-06-27 20:32:24 +00:00
|
|
|
Color types.ChessColor
|
|
|
|
}
|
|
|
|
|
|
|
|
func (k King) GetAllAttackedSquares(board Board, fromSquare types.Coordinate) []types.Coordinate {
|
|
|
|
return k.GetAllNonBlockedMoves(board, fromSquare)
|
2023-06-20 21:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (k King) GetColor() types.ChessColor {
|
|
|
|
return k.Color
|
|
|
|
}
|
|
|
|
|
2023-06-27 20:32:24 +00:00
|
|
|
func (k King) GetAllNonBlockedMoves(board Board, fromSquare types.Coordinate) []types.Coordinate {
|
2023-06-28 06:32:17 +00:00
|
|
|
return board.GetNonBlockedKingMoves(fromSquare)
|
2023-06-20 21:53:54 +00:00
|
|
|
}
|