/// <summary>
 /// The implementation of the request handler dealing with coordinates outside of the board
 /// </summary>
 /// <param name="row">The passed int for row</param>
 /// <param name="col">The passed int for column</param>
 /// <param name="board">The current playing board</param>
 public override void HandleRequest(int row, int col, IBoard board)
 {
     if (!board.IsInsideBoard(row, col))
     {
         board.ChangeBoardState(new Notification(GlobalMessages.OutOfBorders, BoardState.Pending));
     }
     else if (this.Successor != null)
     {
         this.Successor.HandleRequest(row, col, board);
     }
 }
 /// <summary>
 /// The implementation of the request handler dealing with already revealed cells
 /// </summary>
 /// <param name="row">The row of the cell</param>
 /// <param name="col">The column of the cell</param>
 /// <param name="board">The current playing board</param>
 public override void HandleRequest(int row, int col, IBoard board)
 {
     if (board.IsAlreadyShown(row, col))
     {
         board.ChangeBoardState(new Notification(GlobalMessages.CellAlreadyRevealed, BoardState.Pending));
     }
     else if (this.Successor != null)
     {
         this.Successor.HandleRequest(row, col, board);
     }
 }
 /// <summary>
 /// The implementation of the request handler dealing with cells that contain bombs
 /// </summary>
 /// <param name="row">The row of the cell</param>
 /// <param name="col">The column of the cell</param>
 /// <param name="board">The current playing board</param>
 public override void HandleRequest(int row, int col, IBoard board)
 {
     if (board.IsBomb(row, col))
     {
         board.ChangeBoardState(new Notification(GlobalMessages.GameOver, BoardState.Closed));
     }
     else if (this.Successor != null)
     {
         this.Successor.HandleRequest(row, col, board);
     }
 }
        /// <summary>
        /// A method that checks whether the command is valid and deals with it or calls its successor to handle the request
        /// </summary>
        /// <param name="command">String with the incoming command</param>
        /// <param name="board">The current playing board</param>
        public override void HandleRequest(string command, IBoard board)
        {
            this.IsInvalid = false;
            int row = -1;
            int col = -1;

            string trimmedCommand = command.Trim();
            string[] commandComponents = trimmedCommand.Split(GlobalConstants.CommandParametersDivider);
            if (commandComponents.Length < 2 || commandComponents.Length > 2)
            {
                this.IsInvalid = true;
            }
            else
            {
                bool rowIsNumeric = int.TryParse(commandComponents[0], out row);
                bool colIsNumeric = int.TryParse(commandComponents[1], out col);

                if (!(rowIsNumeric && colIsNumeric))
                {
                    this.IsInvalid = true;
                }
            }

            if (this.IsInvalid)
            {
                board.ChangeBoardState(new Notification(GlobalMessages.InvalidCommand, BoardState.Pending));
            }
            else if (this.Successor != null)
            {
                if (board.IsInsideBoard(row, col) && board.Cells[row, col].Content.Value == 0)
                {
                    this.Accumulate(row, col, board);

                    // Reset list for next play command
                    this.visited.Clear();
                }
                else
                {
                    this.Successor.HandleRequest(row, col, board);
                }
            }

            base.HandleRequest(row, col, board);
            base.HandleRequest(row + " " + col, board);
        }
 /// <summary>
 /// Method revealing the cell with the passed row and column and changing the board state
 /// </summary>
 /// <param name="row">The row of the cell</param>
 /// <param name="col">The column of the cell</param>
 /// <param name="board">The current playing board</param>
 public override void HandleRequest(int row, int col, IBoard board)
 {
     board.RevealCell(row, col);
     board.ChangeBoardState(new Notification(string.Empty, BoardState.Open));
 }