Exemplo n.º 1
0
        public void Run(IRegistry registry)
        {
            IBoard             board             = registry.Board;
            IProcessUserInput  processUserInput  = registry.ProcessUserInput;
            IShowMessageToUser showMessageToUser = registry.ShowMessageToUser;
            IExecuteUserChoice executeUserChoice = registry.ExecuteUserChoice;
            IDrawing           drawing           = registry.Drawing;

            board.SetBoardSize(40, 20);
            drawing.DrawBoard(board);
            showMessageToUser.ShowHelloToUser();
            showMessageToUser.ShowInstructionForUser("Enter the action to affect the board:");

            while (true)
            {
                int currentChoice = processUserInput.GetChoice();
                if (executeUserChoice.IsExit(currentChoice))
                {
                    break;
                }
                if (!executeUserChoice.IsValid(currentChoice))
                {
                    showMessageToUser.ShowInstructionForUser("Ivalid input! Please, try again, choose from the options.");
                    continue;
                }
                executeUserChoice.MakeFigure(board, drawing, currentChoice);
            }
        }