public bool Move(ChessLocation location)
 {
     // TODO: Validation
     this.Location      = location;
     this.HasMoved      = true;
     this._lastMoveTurn = this.Board.Turn;
     return(true);
 }
 public ChessMove(ChessLocation from, ChessLocation to, bool isAttackingMove = true)
 {
     this.from            = from;
     this.to              = to;
     this.IsAttackingMove = isAttackingMove;
     this.targetLocation  = null;
     this.castleFrom      = null;
     this.castleTo        = null;
     this.promoteTo       = null;
 }
Exemple #3
0
        private void AddMoveRange(List <ChessMove> moves, int x, int y, int xi, int yi, int max)
        {
            ChessLocation startLocation = new ChessLocation(x, y);

            do
            {
                x += xi;
                y += yi;

                ChessLocation location = new ChessLocation(x, y);

                if (!location.IsOnBoard)
                {
                    break;
                }

                moves.Add(new ChessMove(startLocation, location));

                if (this[location].IsOccupied)
                {
                    break;
                }
            } while (--max > 0);
        }
Exemple #4
0
 public ChessBoardSquare this[ChessLocation location] => this[location.X, location.Y];
Exemple #5
0
 public ChessPiece GetPieceFromLocation(ChessLocation location) => this.ActivePieces.Where(p => p.Location == location).SingleOrDefault();
 public ChessPiece(ChessBoard board, ChessPlayerColour colour, ChessPieceType type, int number, ChessLocation location, int direction)
     : this(board, colour, type, location, direction)
 {
     this._number = number;
 }
 public ChessPiece(ChessBoard board, ChessPlayerColour colour, ChessPieceType type, ChessLocation location, int direction)
 {
     this.Board     = board;
     this.Colour    = colour;
     this.PieceType = type;
     this.Location  = location;
     this.Direction = direction;
 }