Example #1
0
        public ConsoleUI(GameFlow gameFlow, IConsoleIO console, IStorage storage, RulesEngine rulesEngine)
        {
            if (gameFlow is null)
            {
                throw new ArgumentNullException(nameof(gameFlow));
            }

            if (console is null)
            {
                throw new ArgumentNullException(nameof(console));
            }

            if (storage is null)
            {
                throw new ArgumentNullException(nameof(storage));
            }

            if (rulesEngine is null)
            {
                throw new ArgumentNullException(nameof(rulesEngine));
            }

            GameCmdHandler = new GameCmdHandler(gameFlow, storage, console);
            TurnCmdHandler = new TurnCmdHandler(rulesEngine);
            BoardPrinter   = new BoardPrinter(console, gameFlow);
            CommandParser  = new CommandParser();
            CommandCycle   = new CommandCycle(console, GameCmdHandler, TurnCmdHandler, BoardPrinter, CommandParser);
        }
Example #2
0
        public ConsoleUI(GameFlow gameFlow, IConsoleIO console, IStorage storage, RulesEngine rulesEngine)
        {
            CheckArg.NotNull(gameFlow);
            CheckArg.NotNull(console);
            CheckArg.NotNull(storage);
            CheckArg.NotNull(rulesEngine);

            GameCmdHandler = new GameCmdHandler(gameFlow, storage, console);
            TurnCmdHandler = new TurnCmdHandler(rulesEngine);
            BoardPrinter   = new BoardPrinter(console, gameFlow);
            CommandParser  = new CommandParser();
            CommandCycle   = new CommandCycle(console, GameCmdHandler, TurnCmdHandler, BoardPrinter, CommandParser);
        }