private Robot RunMission(Mission mission) { // We will run the commands with a copy of the mission's robot, so the original is untouched. Robot robot = new Robot(mission.Robot); // mission.Commands is a string where each character will be interpreted by the robot as a command. foreach (char c in mission.Commands) { robot.ExecuteCommand(c.ToString(), config.Grid); } return robot; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here graphics.PreferredBackBufferWidth = 600; graphics.PreferredBackBufferHeight = 300; graphics.ApplyChanges(); //Create our Robots a = new Robot(new Vector2(4.0f, 200.0f), new Vector2(0.5f, 0.0f)); wallie = new Robot(new Vector2(50.0f, 100.0f), Vector2.Zero); Console.WriteLine(a.Pos); base.Initialize(); }
public Mission(Robot robot, string commands) { Robot = robot; Commands = commands; }
private static string GenerateOutputLine(Robot robot) { return string.Format("{0} {1} {2}", robot.X, robot.Y, robot.Facing); }
public Robot(Robot other) { X = other.X; Y = other.Y; Facing = other.Facing; }
private void AssertRobot(Robot robot, int x, int y, Direction facing) { Assert.AreEqual(x, robot.X); Assert.AreEqual(y, robot.Y); Assert.AreEqual(facing, robot.Facing); }