Example #1
0
        static void Main(string[] args)
        {
            int min      = 0;
            int max      = 100;
            int countTry = 8;

            FactoryResultDifferent factoryResult = new FactoryResultDifferent();

            new EndlessRepetitionWithExitDecorateIMessange(
                new AttempMessange(
                    new Attempt(
                        new Different(
                            new Secret(
                                new Random(),
                                min,
                                max,
                                new ForgeColorDecorateIMessange(
                                    new DialogMessange(
                                        $"Загадано число между {min} и {max}"),
                                    ConsoleColor.Blue)),
                            factoryResult,
                            new  ForgeColorDecorateIntInput(
                                ConsoleColor.Yellow,
                                new BeforeMessageDecorateIntInput(
                                    $"\nПопробуйте угадать число, вводить только цифры {min}-{max}",
                                    new BoundedIntInput(
                                        new CheckInt(min, max)
                                        )
                                    )
                                )
                            ),
                        countTry,
                        factoryResult
                        )
                    ),
                new FreeIntInput(),
                new ForgeColorDecorateIMessange(
                    new DialogMessange("Введите 0 для выхода. Другое число продолжит игру\n"),
                    ConsoleColor.Magenta),
                0).Say(true);
        }
Example #2
0
 public Attempt(IDifferent different, int countTry, FactoryResultDifferent factoryResultDifenet)
 {
     _countTry      = countTry;
     _different     = different;
     _factoryResult = factoryResultDifenet;
 }
Example #3
0
 public Different(Secret secret, FactoryResultDifferent factoryResult, IIntInput guess)
 {
     _secret        = secret;
     _guess         = guess;
     _factoryResult = factoryResult;
 }