public static ICleanerPilot CreateCleaningRobotAt(Position startingPosition)
 {
     var grid = RectangularGrid.MinX(-100000).MaxX(100000).MinY(-100000).MaxY(100000);
     var robot = new RobotEngine(startingPosition);
     var restrictedRobot = new GridRestrictedRobotEngine(robot, grid);
     return new RobotPilot(restrictedRobot);
 }
예제 #2
0
        public void Go_To_Next_Until_Get_To_End_Test(string mazeId, string state)
        {
            var          stubPathService = new Mock <IPathService>();
            var          server          = FluentMockServer.Start(null, false);
            var          client          = new RestfulClient(server.Urls.Select(u => string.Concat(new Uri(u))).First() + "pony-challenge/maze", true);
            IGameService gameService     = new GameService(client);

            var resultResponseMove = new ResponseMove();
            var pathWay            = new Model.Robot.PathWay(0, new List <MoveType> {
                MoveType.West
            });

            stubPathService.Setup(fm => fm.FindMoves(mazeId)).Returns(pathWay);

            var responseBody = new Dictionary <string, object>
            {
                ["state"]        = "active",
                ["state-result"] = "Move accepted"
            };

            server.Given(Request.Create().UsingPost())
            .RespondWith(Response.Create()
                         .WithStatusCode(200)
                         .WithHeader("content-type", "application/json; charset=utf-8")
                         .WithBodyAsJson(responseBody, Encoding.UTF8));

            var roboteEngine = new RobotEngine(gameService, stubPathService.Object);
            var result       = roboteEngine.GotoNext(mazeId);

            Assert.AreEqual(result.State, "active");
        }
예제 #3
0
        public static ICleanerPilot CreateCleaningRobotAt(Position startingPosition)
        {
            var grid            = RectangularGrid.MinX(-100000).MaxX(100000).MinY(-100000).MaxY(100000);
            var robot           = new RobotEngine(startingPosition);
            var restrictedRobot = new GridRestrictedRobotEngine(robot, grid);

            return(new RobotPilot(restrictedRobot));
        }
예제 #4
0
        private void DoExecuteCommand(string schema, string command, string option)
        {
            var engine = new RobotEngine(serverUrl, option);

            this.commandObject = engine;

            engine.Execute();

            this.Close();
        }
예제 #5
0
        public override FScheme.Value Evaluate(FSharpList <FScheme.Value> args)
        {
            _eng = (RobotEngine)((Value.Container)args[0]).Item;

            var nodes_in  = ((Value.List)args[1]).Item;
            var bars_in   = ((Value.List)args[2]).Item;
            var plates_in = ((Value.List)args[3]).Item;

            var nodes  = nodes_in.Select(x => ((AnalyticalNode)((Value.Container)x).Item));
            var bars   = bars_in.Select(x => ((AnalyticalBar)((Value.Container)x).Item));
            var plates = plates_in.Select(x => ((AnalyticalPlate)((Value.Container)x).Item));

            RobotModel model = new RobotModel(_eng.Application, nodes, bars, plates);

            model.Analyze();
            model.GetResults();

            return(Value.NewContainer(model));
        }
예제 #6
0
        public override FScheme.Value Evaluate(FSharpList <FScheme.Value> args)
        {
            RobotEngine engine = new RobotEngine();

            return(Value.NewContainer(engine));
        }