/// <summary> /// Private static helper that triggers a Robot Factories /// DeployRobots method (affecting Robots in the Factory). /// </summary> /// <param name="robotFactory">The Robot Factory to trigger the action on.</param> private static void DeployRobots(IRobotFactory robotFactory) { // If Factory is not null then deploy the Robots robotFactory?.DeployRobots().ToList().ForEach(robot => { // If each robot is not null then trigger various robot behaviours (move, speak, attack, etc) and 'output', depending on implementation if (robot != null) { robot.Move(); robot.Speak(); robot.Attack(); if (robot is ISmallRobot) { ((ISmallRobot)robot).Sneak(); } else if (robot is ILargeRobot) { ((ILargeRobot)robot).Crush(); } } Console.WriteLine(); }); }
public void Initialise() { _battleArena = new BattleArenaFactory().Create(5, 5); _currentGame = new Game(null); _robotFactory = new RobotFactory(); _commandParser = new DeployRobotCommandParser(_currentGame, _robotFactory); }
public CompetitionBootstrap(IBattleArena battleArena, INavigationSystem navigationSystem, IRobotFactory robotFactory, IArenaFactory arenaFactory, IConsoleWrapper console, ILogWriter logWriter) { _logWriter = logWriter; _console = console; _gameConsole = new GameConsole(battleArena, navigationSystem, robotFactory, arenaFactory, console, logWriter); }
public RegisterRobotService(ILogger logger, IRobotFactory robotFactory) { _logger = logger; _robotFactory = robotFactory; FetchRobotsFromLibrary(); }
public Controller() { this.garage = new Garage(); this.robotFactory = new RobotFactory(); this.procedureFactory = new ProcedureFactory(); this.procedures = new ProcedureRepository(); }
/// <summary> /// Private static helper that triggers a Robot Factories /// Paint/AttachWeapons methods (affecting Robots in the Factory). /// </summary> /// <param name="robotFactory">The Robot Factory to trigger actions on.</param> private static void PerformFactoryProcessing(IRobotFactory robotFactory) { if (robotFactory != null) { robotFactory.PaintRobots(); robotFactory.AttachWeapons(); } }
public Mars(IGrid grid, IRobotFactory robotFactory) { Contract.Requires(grid != null); Contract.Requires(robotFactory != null); this.grid = grid; this.robotFactory = robotFactory; }
public ApplicationState(IRobotFactory robotFactory, IProgramExecutionService programExecutionService) { var robots = robotFactory.GetRegisteredRobots(); RobotsList.Capacity = robots.Count(); foreach (var r in robots) { RobotsList.Add(new RobotState(programExecutionService, r, new RobotLog())); } }
public World(IGrid grid, IRobotFactory robotFactory, IRobotInstructionHandler[] instructionHandlers) { _brain = new StateMachine(); _grid = grid; _robotFactory = robotFactory; _robots = new List <Robot>(); _dispatcher = instructionHandlers.ToDictionary(rc => rc.Key, rc => rc); _parser = new Parser(instructionHandlers); _brain.SetState(InitializeGrid); }
public GameConsole(IBattleArena battleArena, INavigationSystem navigationSystem, IRobotFactory robotFactory, IArenaFactory arenaFactory, IConsoleWrapper console, ILogWriter logWriter) { _battleArena = battleArena; _navigationSystem = navigationSystem; _console = console; _logWriter = logWriter; _robotMapper = new RobotMapper(robotFactory, arenaFactory); _arenaMapper = new ArenaMapper(arenaFactory); }
public void Initialise() { _robotFactory = new RobotFactory(); }
public RobotMapper(IRobotFactory robotFactory, IArenaFactory arenaFactory) { _robotFactory = robotFactory; _arenaMapper = new ArenaMapper(arenaFactory); }
public RobotStrategy(IRobotFactory robotFactory) { this.robotStrategy = robotFactory; }
public DeployRobotCommandParser(IGameConfiguration currentGameConfiguration, IRobotFactory robotFactory) : base(currentGameConfiguration, regexPattern) { _robotFactory = robotFactory; }