//// TODO: Remove magic values and make them better formated /// <summary> /// Execute a play command. /// </summary> /// <param name="playBoard">Current play board.</param> /// <param name="playerMoves">Value of player moves.</param> public void Execute(ref char[,] playBoard, ref int playerMoves) { var userRow = int.Parse(this.currentCommand[0].ToString()); if (userRow > playBoard.GetLength(0) - 1) { Console.WriteLine("Wrong input ! Try Again ! "); return; } var userColumn = int.Parse(this.currentCommand[2].ToString()); var gameLogic = new GameLogic(); if (gameLogic.CheckIfEmpty(playBoard, userRow, userColumn)) { Console.WriteLine("cannot pop missing ballon!"); return; } gameLogic.PopBaloons(playBoard, userRow, userColumn); playerMoves++; var winner = new WinnerValidator(); if (winner.CheckIfIsWinner(playBoard)) { Console.WriteLine("Gratz ! You completed it in {0} moves.", playerMoves); if (winner.SignIfSkilled(this.topPlayers, playerMoves)) { this.scoreBoard.PrintTopPlayers(this.topPlayers); } else { Console.WriteLine("I am sorry you are not skillful enough for TopFive chart!"); } playBoard = this.board.GenerateBoard(); playerMoves = 0; } this.printer.PrintPlayBoard(playBoard); }