Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var config = ConfigurationLoader.LoadMastermindConfiguration(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                                                      "Config", "standardConfig.json"));
            var randomCodeGenerator = new RandomCodeGenerator(config);
            var feedbackRandomizer  = new FeedbackRandomizer();
            var codeChecker         = new CodeChecker(randomCodeGenerator, feedbackRandomizer);
            var game       = new Game(config, codeChecker);
            var gameEngine = new GameEngine(new ConsoleDisplay(), new ConsoleInputCollector(), new ConsoleInputProcessor(config), game);

            gameEngine.PlayGame();

            var input1 = new List <string>
            {
                "blue, blue, green, green",
                "Red, blue, red, RED",
                "Blue, yellow, Green, red",
                "Blue, yellow, Green, red",
                "Blue, Green, PURPLE, Red",
                "blue, green, orange, red"
            };

            var input2 = new List <string>
            {
                "blue, yellow, pink, orange",
                "",
                "blue, blue, blue",
                "green, green, orange, orange, orange",
                "yellow, orange, red, rainbow",
                "blue, green, orange, red"
            };

            //DemoGame(input2);
        }
Ejemplo n.º 2
0
        public static void DemoGame(List <string> input)
        {
            var config = ConfigurationLoader.LoadMastermindConfiguration(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                                                      "Config", "standardConfig.json"));
            var staticCodeGenerate = new  CodeGenerator(new List <Peg> {
                Peg.Blue, Peg.Green, Peg.Orange, Peg.Red
            });
            var feedbackRandomizer = new FeedbackRandomizer();
            var codeChecker        = new CodeChecker(staticCodeGenerate, feedbackRandomizer);
            var game           = new Game(config, codeChecker);
            var consoleDisplay = new ConsoleDisplay();
            var gameEngine     = new GameEngine(consoleDisplay, new ConsoleDemoInputCollector(input, consoleDisplay), new ConsoleInputProcessor(config), game);

            gameEngine.PlayGame();
        }