コード例 #1
0
 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;
 }
コード例 #2
0
ファイル: Game1.cs プロジェクト: ramanspectre/Piano-Prototype
        /// <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();
        }
コード例 #3
0
 public Mission(Robot robot, string commands)
 {
     Robot = robot;
     Commands = commands;
 }
コード例 #4
0
 private static string GenerateOutputLine(Robot robot)
 {
     return string.Format("{0} {1} {2}", robot.X, robot.Y, robot.Facing);
 }
コード例 #5
0
ファイル: Robot.cs プロジェクト: alwaysthecritic/RobotsCSharp
 public Robot(Robot other)
 {
     X = other.X;
     Y = other.Y;
     Facing = other.Facing;
 }
コード例 #6
0
 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);
 }