public override void Execute(BoardMove move)
        {
            var piece = BoardState.GetItem(move.From).Item as PawnEntity;

            piece.TwoStep = true;
            ActionProvider.Create((int)DefaultActions.MoveOnly, BoardState).Execute(move);
        }
 public override void Execute(BoardMove move)
 {
     if (BoardState.IsEmpty(move.To))
     {
         ActionProvider.Create((int)DefaultActions.MoveOnly, BoardState).Execute(move);
     }
     else
     {
         ActionProvider.Create((int)DefaultActions.TakeOnly, BoardState).Execute(move);
     }
 }
Esempio n. 3
0
        public override void Execute(BoardMove move)
        {
            var takenItem = BoardState.GetItem(move.To);

            if (takenItem == null)
            {
                throw new Exception("No piece found for TakeOnly action");
            }

            BoardState.Remove(move.To);

            ActionProvider.Create((int)DefaultActions.MoveOnly, BoardState).Execute(move);
        }
        public override void Execute(BoardMove move)
        {
            if (BoardState.IsEmpty(move.From))
            {
                return;
            }

            var piece = BoardState.GetItem(move.From).Item;

            var passedPieceLoc = move.To.MoveBack((Colours)piece.Owner);

            BoardState.Remove(passedPieceLoc);
            ActionProvider.Create((int)DefaultActions.MoveOnly, BoardState).Execute(move);
        }
Esempio n. 5
0
        public override void Execute(BoardMove move)
        {
            BoardMove kingMove, rookMove;

            if (move.From.X < move.To.X) // King Side
            {
                kingMove = new BoardMove(move.From, $"G{move.From.Y}".ToBoardLocation(), (int)DefaultActions.MoveOnly);
                rookMove = new BoardMove($"H{move.From.Y}".ToBoardLocation(), $"F{move.From.Y}".ToBoardLocation(), (int)DefaultActions.MoveOnly);
            }
            else
            {
                kingMove = new BoardMove(move.From, $"C{move.From.Y}".ToBoardLocation(), (int)DefaultActions.MoveOnly);
                rookMove = new BoardMove($"A{move.From.Y}".ToBoardLocation(), $"D{move.From.Y}".ToBoardLocation(), (int)DefaultActions.MoveOnly);
            }

            var moveOnly = ActionProvider.Create((int)DefaultActions.MoveOnly, BoardState);

            moveOnly.Execute(kingMove);
            moveOnly.Execute(rookMove);
        }