Ejemplo n.º 1
0
 public bool Move(ChessLocation location)
 {
     // TODO: Validation
     this.Location      = location;
     this.HasMoved      = true;
     this._lastMoveTurn = this.Board.Turn;
     return(true);
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
 public ChessBoardSquare this[ChessLocation location] => this[location.X, location.Y];
Ejemplo n.º 5
0
 public ChessPiece GetPieceFromLocation(ChessLocation location) => this.ActivePieces.Where(p => p.Location == location).SingleOrDefault();
Ejemplo n.º 6
0
 public ChessPiece(ChessBoard board, ChessPlayerColour colour, ChessPieceType type, int number, ChessLocation location, int direction)
     : this(board, colour, type, location, direction)
 {
     this._number = number;
 }
Ejemplo n.º 7
0
 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;
 }