engine

package
v0.0.0-...-1655155 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChessBoard

type ChessBoard struct {
	Cells    map[int]string // Numeric Position to Text Representation. For e.g. 10 -> B2
	Pieces   map[int]*Piece // Numeric Position --> Piece. For printing purposes only
	StrCells map[string]int // Text Representation to Numeric Position of a cell
}

func CreateChessBoard

func CreateChessBoard() *ChessBoard

Create new chessboard Create cells with their numeric identifiers

func (*ChessBoard) PlacePiece

func (b *ChessBoard) PlacePiece(pos int, p *Piece)

Place piece on a chessboard and update available move positions for a piece.

pos numeric position on board p Piece

func (*ChessBoard) Print

func (b *ChessBoard) Print()

Render chessboard

type DiagonalBoundry

type DiagonalBoundry struct {
	// contains filtered or unexported fields
}

Diagonal boundries for a piece

type Direction

type Direction int // Move direction of a piece
const (
	Positive Direction = iota
	Negative
)

type Piece

type Piece struct {
	Kind     string       // Kind of piece. e.g. king, queen, horse, pawn, rook, bishop
	CurPos   int          // Numeric position on board
	Symbol   string       // e.g. ♚, ♛, ♜, ♝, ♞
	AvailPos map[int]bool // Available move positions for a piece
	// contains filtered or unexported fields
}

Chessboard piece

func CreatePiece

func CreatePiece(pos int, n string) *Piece

Create piece

pos: Numeric position of a piece on board n: Piece type

type XBoundry

type XBoundry struct {
	// contains filtered or unexported fields
}

Boundries in horizontal direction for a piece

type YBoundry

type YBoundry struct {
	// contains filtered or unexported fields
}

Boundries in vertical direction for a piece

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL