Ejemplo n.º 1
0
        public static TaskResults Run(Coaster coaster, List <float> angles)
        {
            List <BuildAction> buildActions = new List <BuildAction>();
            TaskResults        results      = TaskResults.Fail;

            buildActions.Clear();

            for (int i = 0; i < 15; i++)
            {
                float startPitch = coaster.LastTrack.Pitch;
                foreach (float angle in angles)
                {
                    results = Builder.BuildTracks(DetermineActions(angle, i, startPitch), coaster);
                    if (results == TaskResults.Successful)
                    {
                        return(results);
                    }
                    else
                    {
                        coaster.Reset();
                    }
                }
            }
            return(results);
        }
Ejemplo n.º 2
0
        public static TaskResults Run(Coaster coaster, float x, float y, float xRange, float yRange)
        {
            //Determine Left, Or Right to Try first
            TaskResults results = TaskResults.Fail;
            bool        Left    = true;
            float       yawGoal = Convert.ToSingle(Math.Atan2(
                                                       (y - coaster.LastTrack.Y),
                                                       (x - coaster.LastTrack.X)) * 180 / Math.PI);
            int totalAdjustments = (int)(yawGoal / Globals.STANDARD_ANGLE_CHANGE);

            if ((yawGoal % 15) > Globals.STANDARD_ANGLE_CHANGE / 2)
            {
                totalAdjustments++;
            }
            List <BuildAction> buildActions = new List <BuildAction>();


            yawGoal = totalAdjustments * Globals.STANDARD_ANGLE_CHANGE;
            Left    = (Math.Abs(yawGoal - coaster.LastTrack.Yaw) < 180);
            for (int i = 0; i <= 3; i++)
            {
                //Try Level
                coaster.Reset();
                results = Runner(coaster, i, x, y, xRange, yRange, Left);
                if (results != TaskResults.Successful)
                {
                    coaster.Reset();
                    results = Runner(coaster, i, x, y, xRange, yRange, !Left);
                }

                //Try Going Up First
                if (results != TaskResults.Successful)
                {
                    coaster.Reset();
                    results = Runner(coaster, i, x, y, xRange, yRange, Left, 100);
                }
                if (results != TaskResults.Successful)
                {
                    coaster.Reset();
                    results = Runner(coaster, i, x, y, xRange, yRange, !Left, 100);
                }
                if (results != TaskResults.Successful)
                {
                    coaster.Reset();
                    results = Runner(coaster, i, x, y, xRange, yRange, Left, 100, true);
                }


                //Try Going Down First
                if (results != TaskResults.Successful)
                {
                    coaster.Reset();
                    results = Runner(coaster, i, x, y, xRange, yRange, Left, -100);
                }
                if (results != TaskResults.Successful)
                {
                    coaster.Reset();
                    results = Runner(coaster, i, x, y, xRange, yRange, !Left, -100);
                }
                if (results != TaskResults.Successful)
                {
                    coaster.Reset();
                    results = Runner(coaster, i, x, y, xRange, yRange, Left, -100, true);
                }


                //Reset Coaster
                if (results != TaskResults.Successful)
                {
                    coaster.Reset();
                }
            }

            return(results);
        }