public void Show_current_record_and_semi_auto_matches()
        {
            var potential_matches = Reconciliator.Current_potential_matches();

            _input_output.Output_line("");
            _input_output.Output_line("*****************************************************************************");
            _input_output.Output_line("*****************************************************************************");
            _input_output.Output_line($"Source record for {Third_party_descriptor}, with best match immediately afterwards:");
            _input_output.Output("   ");
            _input_output.Output_line(Reconciliator.Current_source_record_as_console_line());
            if (potential_matches[0].Console_lines.Count > 1)
            {
                _input_output.Output_line($"Total: {potential_matches[0].Actual_records.Sum(x => x.Main_amount()).To_csv_string(true)}");
            }
            foreach (var console_line in potential_matches[0].Console_lines)
            {
                _input_output.Output_line(console_line.Get_console_snippets(potential_matches[0]));
            }

            _input_output.Output_line("..............");
            _input_output.Output_line($"Other matches found from {Owned_file_descriptor}:");
            _input_output.Output_line("***********");
            _input_output.Output_line("Enter the number next to the option you want.");
            _input_output.Output_all_lines_except_the_first(potential_matches);
            _input_output.Output_line("***********");
        }
예제 #2
0
        public void RunSort(Func <ReadOnlyCollection <int>, ReadOnlyCollection <int> > action)
        {
            try{
                int numberCount = inputOutputHandler.PromptUserForNumber("Enter the how many numbers that will be sorted:");
                ReadOnlyCollection <int> originalNumbers = inputOutputHandler.BuildNumbersArray(numberCount);
                ReadOnlyCollection <int> sortedNumbers   = action(originalNumbers);

                inputOutputHandler.OutputNumbers("Before: ", originalNumbers);
                inputOutputHandler.OutputNumbers("After: ", sortedNumbers);
            }catch (Exception ex) {
                inputOutputHandler.Output($"Error occurred {ex.Message}");
            }

            inputOutputHandler.Output("Press any key to quit the application.");
            inputOutputHandler.ReadInput();
        }
예제 #3
0
        public void Start()
        {
            Console.Clear();
            var newCard = ShuffledDeck.PopCard();

            Player.DrawCard(newCard);
            var newCardTwo = ShuffledDeck.PopCard();

            Player.DrawCard(newCardTwo);

            _iio.Output("Your first two cards are: ");
            Player.PrintHandCard();

            _iio.Output($"You are currently at {Player.Sum()}");

            if (Player.DetermineBlackjack())
            {
                _iio.Output("Player has won!! Yay!");
                _stateOfGamePlay = false;
            }

            var newCardThree = ShuffledDeck.PopCard();

            Dealer.DrawCard(newCardThree);

            var newCardFour = ShuffledDeck.PopCard();

            Dealer.DrawCard(newCardFour);
            GamePlay();
        }
예제 #4
0
        public Direction DecideNextMove(List <Direction> listOfOptions)
        {
            Direction result;
            string    stringToOutput = ConstructDirectionInstructionMessage(listOfOptions);

            _io.Output(stringToOutput);
            string errorMessage;
            string userInput;

            do
            {
                errorMessage  = "";
                userInput     = _io.Input().ToLower();
                errorMessage += GenerateErrorMessage(listOfOptions, userInput);
                Print(errorMessage);
            } while (errorMessage != "");
            result = inputRef[userInput];
            return(result);
        }
예제 #5
0
 public void Print()
 {
     if (figure.Count != 0)
     {
         foreach (IComparable obj in figure)
         {
             IInputOutput outputObject = obj as IInputOutput;
             outputObject.Output();
         }
     }
 }
예제 #6
0
 private void BetweenValues(int _aValue, int _bValue)
 {
     for (int i = 0; i < figure.Count; i++)
     {
         IShape currentObject = figure[i] as IShape;
         if (currentObject.Perimeter >= _aValue && currentObject.Perimeter <= _bValue)
         {
             IInputOutput outputObject = currentObject as IInputOutput;
             outputObject.Output();
         }
     }
 }
예제 #7
0
 private void PrintDetails(string name, string surname, string startDate, string endDate, PayslipCalculator payslipCalculator)
 {
     _iio.Output("Your payslip has been generated:");
     _iio.Output($"{name} {surname}");
     _iio.Output($"Pay Period {startDate} - {endDate}");
     _iio.Output($"Gross Income: {payslipCalculator.GetGrossIncome()}");
     _iio.Output($"Income Tax: {payslipCalculator.GetIncomeTax()}");
     _iio.Output($"Net Income: {payslipCalculator.GetNetIncome()}");
     _iio.Output($"Super: {payslipCalculator.GetSuper()}");
 }
예제 #8
0
        public void RunSearch(Func <int, ReadOnlyCollection <int>, int> action)
        {
            try{
                int numberCount = inputOutputHandler.PromptUserForNumber("Enter the how many numbers that will be searched:");
                ReadOnlyCollection <int> originalNumbers = inputOutputHandler.BuildNumbersArray(numberCount);
                int desiredNumber = inputOutputHandler.PromptUserForNumber("Enter the desired number to be found:");
                int result        = action(desiredNumber, originalNumbers);

                if (result == -1)
                {
                    inputOutputHandler.Output("Number not found.");
                }
                else
                {
                    inputOutputHandler.Output($"Number found at index: {result}");
                }
            }catch (Exception ex) {
                inputOutputHandler.Output($"Error occurred {ex.Message}");
            }

            inputOutputHandler.Output("Press any key to quit the application.");
            inputOutputHandler.ReadInput();
        }
예제 #9
0
        public void PlayGame()
        {
            _iio.Output($"Please enter coordinates in the format x,y. Note valid coordinates are between 0 and {_board.Size-1}.");
            _iio.Output(DisplayBlankBoard());
            while (true)
            {
                var coordinate = _player.PlayTurn();

                if (_board.NoSquareRevealed())
                {
                    _iMineGenerator.SetFirstMove(coordinate);
                    _iMineGenerator.PlaceMinesToBoard(_board);
                }

                //for testing purposes
                //_iio.Output(RevealAllMinesAndHints());
                while (!MoveValidator.IsValidMove(coordinate, _board))
                {
                    _iio.Output($"Please enter a valid move.");
                    coordinate = _player.PlayTurn();
                }

                var square = _board.GetSquare(coordinate);
                if (!square.IsMine)
                {
                    square.IsRevealed = true;
                    GameStatus        = GameStatus.Playing;
                    _iio.Output("Current play:");
                    _iio.Output(DisplayBoard(false));
                }

                if (HasPlayerWon(coordinate))
                {
                    GameStatus = GameStatus.Won;
                    _iio.Output("Congratulations! You win :)");
                    return;
                }
                if (square.IsMine)
                {
                    square.IsRevealed = true;
                    GameStatus        = GameStatus.Lost;
                    _iio.Output("You stepped on a mine! You lose :(");
                    _iio.Output(DisplayBoard(true));
                    return;
                }
            }
        }
예제 #10
0
 public override void PlayTurn()
 {
     while (true)
     {
         _iio.Output($"You are currently at {HandValue()}");
         if (HandValue() < WinningScore && _iio.AskQuestion($"Hit or stay? (Hit = {HitInput}, Stay = {StayInput})")
             == HitInput)
         {
             DrawCard();
         }
         else
         {
             return;
         }
     }
 }
예제 #11
0
        public void PlayGame()
        {
            Player currentPlayer = null;

            // _iio.Output("Here's the current board:");
            _iio.Output(Messages.BoardMessage);

            //printCaption();
            //_iio.Output(MyRsc.CurrentBoard)

            _iio.Output(_board.DisplayBoard());
            while (true)
            {
                currentPlayer = currentPlayer != _player1 ? _player1 : _player2;
                if (currentPlayer != null)
                {
                    var move = currentPlayer.PlayTurn();

                    while (!MoveValidator.IsValidMove(move, _board))
                    {
                        _iio.Output(Messages.BoardPieceTakenMessage);
                        move = currentPlayer.PlayTurn();
                    }

                    _board.PlaceSymbolToCoordinates(currentPlayer.Symbol, move);
                    _iio.Output(Messages.MoveAcceptedMessage);
                    _iio.Output(_board.DisplayBoard());

                    if (HasPlayerWon(currentPlayer, move))
                    {
                        GameStatus = GameStatus.Won;
                        _iio.Output(Messages.WinMessage);
                        _iio.Output(_board.DisplayBoard());
                        return;
                    }
                }

                if (_board.IsFull())
                {
                    _iio.Output(Messages.DrawMessage);
                    GameStatus = GameStatus.Drew;
                    return;
                }
            }
        }
예제 #12
0
파일: Presenter.cs 프로젝트: Aubyn92/Pacman
        public void PrintMap(Block[,] twoDMap, List <ICharacter> characters)
        {
            var numberOfRows    = twoDMap.GetLength(0);
            var numberOfColumns = twoDMap.GetLength(1);
            var stringToPassIn  = "";

            for (int row = 0; row < numberOfRows; row++)
            {
                for (int column = 0; column < numberOfColumns; column++)
                {
                    stringToPassIn += AssignSymbol(characters, row, column, twoDMap);
                }

                if (row < numberOfRows - 1)
                {
                    stringToPassIn += "\n";
                }
            }

            _io.Output(stringToPassIn);
        }
예제 #13
0
        public void StartGame()
        {
            // _winningPlayer = new List<Player>();
            DealHands();

            EachPlayerPlayTurn();

            _iio.Output($"The dealer's hand before hitting is {_dealer.HandValue()}");
            _dealer.PlayTurn();

            GetDealerGameStatusBustedOrBlackJack();

            _iio.Output($"The dealer's hand is {_dealer.HandValue()}");

            DisplayPlayerAndDealerFinalResult();
        }
예제 #14
0
 private void WelcomePlayers()
 {
     _iio.Output("Welcome to Tic Tac Toe!");
 }