Exemple #1
0
        public void Test()
        {
            var compiler = new RobotCompiler();
            var input    = new StringBuilder()
                           .AppendLine("MoveForward();")
                           .AppendLine("RotateLeft();")
                           .AppendLine("RotateRight();")
                           .AppendLine("Pickup();")
                           .AppendLine("Drop();")
                           .ToString();
            var result = compiler.Compile(input);

            Assert.IsTrue(result.Result);
            Assert.AreEqual(Core.Compiler.Action.MoveForward, result.Actions[0]);
            Assert.AreEqual(Core.Compiler.Action.RotateLeft, result.Actions[1]);
            Assert.AreEqual(Core.Compiler.Action.RotateRight, result.Actions[2]);
            Assert.AreEqual(Core.Compiler.Action.Pickup, result.Actions[3]);
            Assert.AreEqual(Core.Compiler.Action.Drop, result.Actions[4]);
        }
Exemple #2
0
 public Engine(BaseWorld world, string input)
 {
     this.world = world;
     this.input = input;
     compiler   = new RobotCompiler();
 }