mchess-server/chess/queen.go

26 lines
643 B
Go
Raw Normal View History

package chess
2023-06-27 20:32:24 +00:00
import (
"mchess_server/types"
)
type Queen struct {
Color types.ChessColor
}
2023-06-27 20:32:24 +00:00
func (q Queen) GetAllAttackedSquares(board Board, fromSquare types.Coordinate) []types.Coordinate {
return q.GetAllNonBlockedSquares(board, fromSquare)
2023-06-27 20:32:24 +00:00
}
func (q Queen) GetColor() types.ChessColor {
return q.Color
}
func (q Queen) GetAllNonBlockedSquares(board Board, fromSquare types.Coordinate) []types.Coordinate {
squares := board.GetNonBlockedRowAndColumn(fromSquare)
squares = append(squares, board.GetNonBlockedDiagonals(fromSquare)...)
return squares
}
2023-07-05 19:15:01 +00:00
func (q Queen) AfterMoveAction(board *Board, fromSquare types.Coordinate) {}