コード例 #1
0
        //NEW!!!!!! Changed!
        public void PopulateWorld(WorldDimensions WD, WorldState World, GenAlgorithm Algo)
        {
            // Orient sim camera view point
            this.SetupCamera(WD);

            AddSky();
            AddGround(Algo.GridSquareSize);
            AddBoundaries(WD.xdim, WD.zdim);

            for (int i = 0; i < World.objects.Count; i++)
            {
                if (World.objects[i].type == "obstacle")
                {
                    AddObstacle(World.objects[i].dimension, World.objects[i].position, World.objects[i].name);
                }
                else if (World.objects[i].type == "robot")
                {
                    this.RobotList.Add(AddRobot(World.objects[i]));
                }
                else if (World.objects[i].type == "food")
                {
                    AddFood(World.objects[i].position, World.objects[i].name);
                }
            }
        }
コード例 #2
0
        //NEW!!!!! Changed!
        public OurSimulator Finished()
        {
            //Decrement and run the next environment
            this.BatchMode--;

            //We are finished
            if (this.BatchMode < 1)
            {
                return null;
            }

            DeleteEntities(this);

            //Reads a line in the text file and parses the parameters
            string RawParameters = this.tr.ReadLine();
            string[] DelimitedParameters = RawParameters.Split(',');

            this.Algo = DetermineAlgo(DelimitedParameters);

            Console.WriteLine(this.BatchMode);

            WorldPair MyWorld = RandomBoard(this.Algo.robots, this.Algo.barriers, this.Algo.food, this.Algo.dim);
            Thread.Sleep(3000);
            Console.WriteLine("Not Sleeping anymore");

            if (MyWorld.WS == null) Console.WriteLine("NO WORLD STATE");
            this.SetWorldState(MyWorld.WS);

            this.PopulateWorld(MyWorld.WD, MyWorld.WS, this.Algo);

            CS266.SimCon.Controller.Driver.Driver dr = new CS266.SimCon.Controller.Driver.Driver();
            dr.setOurSim(this);
            dr.runSimulator();

            return this;
        }