mchess-server/types/common.go

36 lines
654 B
Go

package types
type Coordinate struct {
Col int `json:"col"`
Row int `json:"row"`
}
type Move struct {
StartSquare Coordinate `json:"startSquare"`
EndSquare Coordinate `json:"endSquare"`
}
type PieceClass string
const (
Pawn PieceClass = "pawn"
Rook PieceClass = "rook"
Knight PieceClass = "knight"
Bishop PieceClass = "bishop"
Queen PieceClass = "queen"
King PieceClass = "king"
)
type ChessColor string
const (
White ChessColor = "white"
Black ChessColor = "black"
)
type Piece struct {
Class PieceClass
Color ChessColor
HasMoved bool //we need this for pawns (first move is special) and rooks+king (for castling)
}