rules

package
v0.0.0-...-8da6c57 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NE direction = iota
	NW
	SE
	SW
)
View Source
const (
	VALID_MOVE = iota
	NOT_COLORS_TURN
	MOVE_OBSTRUCTED
	MOVE_INCORRECT
	EMPTY_SQUARE
	KING_IN_CHECK
	INVALID_MOVE
	ERROR_CHECKING
	CANNOT_CASTLE
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color int64
const (
	WHITES Color = iota
	BLACKS
)

func (Color) String

func (c Color) String() string

type Game

type Game struct {
	Board         *board.Board
	WhiteCaptured []board.Piece
	BlackCaptured []board.Piece
	NowPlays      Color

	HasWhiteKingMoved      bool `default:"false"`
	HasWhiteRookKingMoved  bool `default:"false"`
	HasWhiteRookQueenMoved bool `default:"false"`

	HasBlackKingMoved      bool `default:"false"`
	HasBlackRookKingMoved  bool `default:"false"`
	HasBlackRookQueenMoved bool `default:"false"`

	HasWhitePawnAJustMovedTwoSquares bool `default:"false"`
	HasWhitePawnBJustMovedTwoSquares bool `default:"false"`
	HasWhitePawnCJustMovedTwoSquares bool `default:"false"`
	HasWhitePawnDJustMovedTwoSquares bool `default:"false"`
	HasWhitePawnEJustMovedTwoSquares bool `default:"false"`
	HasWhitePawnFJustMovedTwoSquares bool `default:"false"`
	HasWhitePawnGJustMovedTwoSquares bool `default:"false"`
	HasWhitePawnHJustMovedTwoSquares bool `default:"false"`

	HasBlackPawnAJustMovedTwoSquares bool `default:"false"`
	HasBlackPawnBJustMovedTwoSquares bool `default:"false"`
	HasBlackPawnCJustMovedTwoSquares bool `default:"false"`
	HasBlackPawnDJustMovedTwoSquares bool `default:"false"`
	HasBlackPawnEJustMovedTwoSquares bool `default:"false"`
	HasBlackPawnFJustMovedTwoSquares bool `default:"false"`
	HasBlackPawnGJustMovedTwoSquares bool `default:"false"`
	HasBlackPawnHJustMovedTwoSquares bool `default:"false"`
}

func NewGame

func NewGame() *Game

func (*Game) ProcessMove

func (g *Game) ProcessMove(p board.Piece, from, to board.SquareName) error

type InvalidMoveReason

type InvalidMoveReason int64

func (InvalidMoveReason) String

func (r InvalidMoveReason) String() string

type Move

type Move struct {
	Piece board.Piece
	From  board.SquareName
	To    board.SquareName
}

Jump to

Keyboard shortcuts

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