Esempio n. 1
0
File: FastAi.cs Progetto: akulin/csb
        private PodMove GenerateLeaderMove(Pod pod, State state)
        {
            var    cp        = state.Checkpoints[pod.NextCheckpointId];
            var    target    = cp - 3 * pod.V;
            double cosDAngle = VecD.FromPolar(1, pod.HeadingInRadians).ScalarProd((target - pod.Pos).Normalize());

            if (pod.CanBoost && cosDAngle > 0.85 && target.DistTo(pod.Pos) > Constants.BoostThrust * 6)
            {
                return(new PodMove(target, 0, MoveType.Boost));
            }
            return(new PodMove(target, (int)(Constants.MaxThrust * cosDAngle.BoundTo(0, 1))));
        }
Esempio n. 2
0
File: Pod.cs Progetto: akulin/csb
 public Pod(
     VecD pos, VecD v, double headingInRadians, int nextCheckpointId, int checkpointsTaken = 0,
     bool canBoost          = true, int timeWithoutCheckpoint = 0, int shieldTicksLeft = 0, int mass = 1,
     bool checkedAtLastTurn = false) : base(pos, v, mass, Constants.PodRadius)
 {
     HeadingInRadians      = headingInRadians;
     NextCheckpointId      = nextCheckpointId;
     CheckpointsTaken      = checkpointsTaken;
     TimeWithoutCheckpoint = timeWithoutCheckpoint;
     ShieldTicksLeft       = shieldTicksLeft;
     CanBoost          = canBoost;
     CheckedAtLastTurn = checkedAtLastTurn;
 }
Esempio n. 3
0
        /*
         *        METHODS:    INFO    (all information is copied
         *                            prior passing to a user)
         */

        public Knot InfoKnotByLocation(VecD vecLocation)
        {
            Knot knotNearestCopy = null;

            if (this.outl != null)
            {
                Knot knotNearest = this.outl.KnotNearest(vecLocation);
                if (knotNearest != null)
                {
                    knotNearestCopy = new Knot(knotNearest);
                }
            }
            return(knotNearestCopy);
        }
Esempio n. 4
0
        /*
         *        METHODS:    MODIFY:    GM
         */

        public bool ModifyMoveKnot(int indKnot, VecD vecLocNew)
        {
            this.fm.OnGM(this.index, DefsGM.TypeGM.ModifyMoveKnot, true);

            Knot knot = this.outl.KnotByInd(indKnot);

            if (knot != null)
            {
                knot.Val.From(vecLocNew);
                bool isChanged;
                knot.Val.FURound(out isChanged);
            }
            return(true);
        }
Esempio n. 5
0
 public PodMove(VecD target, int thrust, MoveType moveType = MoveType.Thrust)
     : this((Vec)target.Round(), thrust, moveType)
 {
 }