mchess-server/chess/queen.go
2023-06-27 22:32:24 +02:00

24 lines
570 B
Go

package chess
import (
"mchess_server/types"
)
type Queen struct {
Color types.ChessColor
}
func (q Queen) GetAllAttackedSquares(board Board, fromSquare types.Coordinate) []types.Coordinate {
return q.GetAllNonBlockedMoves(board, fromSquare)
}
func (q Queen) GetColor() types.ChessColor {
return q.Color
}
func (q Queen) GetAllNonBlockedMoves(board Board, fromSquare types.Coordinate) []types.Coordinate {
squares := board.GetNonBlockedRowAndColumn(fromSquare)
squares = append(squares, board.GetNonBlockedDiagonals(fromSquare)...)
return squares
}