Marco
ff2ec599fe
In order to simplify special moves like en passant or castling for the client, we want to deliver the board state after every move (and not only start square and end square). With PGN we can encode a chess position into a string. This commit implies changes to logic of the pieces' shortnames. This will break the client/server connection (at least for promotions).
26 lines
639 B
Go
26 lines
639 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
|
|
}
|
|
|
|
func (q Queen) AfterMoveAction(board *Board, fromSquare types.Coordinate) {}
|