/// <summary> /// The RoverEnvironment constructor creates the IDirectionsInfoContainer and then /// populates the IRoverControllers and IGraph by passing them the IParser and /// IDirectionsInfoContainer objects. Finally, it does the movement and output for all /// rovers sequentially. /// </summary> /// <param name="fileParser">The IParser containing the graph and rover information.</param> public RoverEnvironment(IParser fileParser) { _directionsInfoContainer = PopulateDirectionsInformation(); _roverGraph = new RoverGraph(fileParser, _directionsInfoContainer); _roverControllers = CreateRoverControllers(fileParser.ParsedRoverDataObjects); MoveAndOutputAllRovers(); }
/// <summary> /// The RoverGraph constructor stores the injected IDirectionsInfoContainer as well as /// the ParsedCoordinatesData of the IParser. /// </summary> /// <param name="fileParser">The IParsed containing the grid and rover data.</param> /// <param name="directionsInfoContainer">The injected IDirectionsInfoContainer object that defines the directions in which the IGraphNodes are connected.</param> public RoverGraph(IParser fileParser, IDirectionsInfoContainer directionsInfoContainer) { _directionsInfoContainer = directionsInfoContainer; // Set the upper right boundary _upperRightCoordinateBoundary = fileParser.ParsedCoordinatesData; _graphData = PopulateGraphNodes(); ConnectAllNodes(); }
/// <summary> /// The RoverController constructor stores the IParsedRoverData object as well as the /// injected IDirectionsInfoContainer object. /// </summary> /// <param name="parsedRoverData">The IParsedRoverData object containing info for the IRover to be controlled.</param> /// <param name="directionsInfoContainer">The injected IDirectionsInfoContainer object that defines the orientation options for the IRover.</param> public RoverController(IParsedRoverData parsedRoverData, IDirectionsInfoContainer directionsInfoContainer) { _parsedRoverData = parsedRoverData; _directionsInfoContainer = directionsInfoContainer; }