예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public void PlayRound()
        {
            // Get Player's Move
            Move playerMove = player.GetMove();

            // Get Computer's Move
            Move computerMove = computer.GetMove();

            // Generate Result
            RoundResult result = new RoundResult(playerMove, computerMove);

            _outputter.Write($"{result.PlayerMove} vs. {result.ComputerMove}!");
            if (result.Result == Result.Win)
            {
                _outputter.Write($"{player.Name} has won this round!");
            }
            else if (result.Result == Result.Lose)
            {
                _outputter.Write($"{computer.Name} has won this round!");
            }
            else if (result.Result == Result.Draw)
            {
                _outputter.Write($"{player.Name} and {computer.Name} have met in a draw this round!");
            }
            else
            {
                throw(new SystemException("Round result invalid?!"));
            }

            // Save Result
            history.Add(result);
            _outputter.Write();
        }
예제 #2
0
        public void ShowResult()
        {
            _outputter.WriteLine(PreparedStrings.ResultBegin);
            Values.ForEach(v => _outputter.Write($"{v} "));
            _outputter.WriteLine(Empty);

            _outputter.WriteLine(Format(PreparedStrings.MinValueOutput, Values.Min(), Values.IndexOf(Values.Min())));
            _outputter.WriteLine(Format(PreparedStrings.MaxValueOutput, Values.Max(), Values.IndexOf(Values.Max())));
        }
예제 #3
0
 public void PrintLine(string input)
 {
     _outputter.Write(input);
 }
예제 #4
0
 public Parser(string fileLocation, IOutputter outputter) : this(outputter)
 {
     _outputter.Write($"Loading character pool from {fileLocation}... ");
     _rawBytes = File.ReadAllBytes(fileLocation);
     _outputter.WriteLine("Success!");
 }
예제 #5
0
 public void PromptForInput()
 {
     _outputter.Write(InputMessage);
 }