Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintPlayerPiece ¶
func PrintPlayerPiece(p *PlayerPiece)
Types ¶
type Board ¶
type Board struct {
Pieces []*PlayerPiece
}
Board is a data structure used to track pieces currently on the board
func (*Board) GetOccupant ¶
func (b *Board) GetOccupant(coord Coord) (*PlayerPiece, bool)
GetOccupant returns a pointer to the piece at the specified coordinate, if it exists there
func (*Board) IsOccupied ¶
IsOccupied returns a boolean indicating if the specified board coordinate is occupied
func (*Board) IsOccupiedByColor ¶
IsOccupiedByColor returns a boolean indicating if the specified board coordinate is occupied by a piece with the specified color
func (*Board) MovePieceTo ¶
func (b *Board) MovePieceTo(piece *PlayerPiece, coord Coord)
MovePieceTo updates the specified piece's coordinate and removes the captured piece from the board (if applicable)
type File ¶
type File uint8
File is a custom type that represents a vertical column (file) on the chess board
type Game ¶
type Game struct { Board Board ValidDestinations ValidDestinations // contains filtered or unexported fields }
Model contains data used for the game
type PlayerPiece ¶
PlayerPiece represents one player's piece
func NewPiece ¶
func NewPiece(color Player, piece Piece, file File, rank Rank) *PlayerPiece
NewPiece returns an instance of PlayerPiece
func NewPlayerPiece ¶
func NewPlayerPiece(color Player, piece Piece) PlayerPiece
NewPlayerPiece returns an instance of PlayerPiece
func (*PlayerPiece) HasMoved ¶
func (p *PlayerPiece) HasMoved() bool
HasMoved returns a boolean indicating if the piece has moved or not
type Rank ¶
type Rank uint8
Rank is a custom type that represents a horizontal row (rank) on the chess board
type ValidDestinations ¶
ValidDestinations contains a set of board coordinates that are valid destinations for a piece
type ValidationResponse ¶
type ValidationResponse struct { Destinations ValidDestinations Check bool CheckedBy map[Piece]Coord }
func NewValidationResponse ¶
func NewValidationResponse() ValidationResponse
func (ValidationResponse) Checkmate ¶
func (v ValidationResponse) Checkmate() bool