Exemple #1
0
        public static Turn ControlRocket(Rocket rocket, Vector target)
        {
            var predcitedVector = rocket.Location + rocket.Velocity + ForcesTask.GetThrustForce(10)(rocket);
            var predictedAngle  = (target - rocket.Location).Angle - (predcitedVector - rocket.Location).Angle;

            return(predictedAngle > 0 ? Turn.Right : Turn.Left);
        }
Exemple #2
0
        private static Vector GetGuessedPoint(Rocket rocket)
        {
            var dt = .3;
            var p  = rocket.Location;
            var f  = ForcesTask.GetThrustForce(1)(rocket);

            while ((p - rocket.Location).Length < 100)
            {
                var v = rocket.Velocity + f * dt;
                p += v * dt;
            }


            return(p);
        }
Exemple #3
0
        public void Move(Size spaceSize, Turn turn)
        {
            var force = ForcesTask.Sum(ForcesTask.GetThrustForce(1.0), ForcesTask.ConvertGravityToForce(Gravity, spaceSize));

            Rocket = physics.MoveRocket(Rocket, force, turn, spaceSize, 0.3);
        }