Example #1
0
        public List<TankAction> Move(TankEnviroment enviroment)
        {
            List<TankAction> ret = new List<TankAction>();

            if (enviroment.IsAimingAtTank)
            {
                ret.Add(TankAction.Shoot);
            }
            else
            {
                ret.Add(TankAction.TurretClockwise);
            }

            return ret;
        }
Example #2
0
        private TankEnviroment SetupEnviroment()
        {
            var ret = new TankEnviroment()
            {
                IsAimingAtTank = false,
                Arena = Game.Arena,
                Cooldown = _cooldown,
                Position = new PointF((float)X, (float)Y),
                Tanks = Game.ActiveTanks,
                TankAngle = this.Angle,
                TurretAngle = this.TurretAngle,
            };

            var newShot = NewShotLocation();
            while (Game.Arena.Border.Contains(newShot))
            {
                if (TrackPathForTarget(ref newShot))
                {
                    ret.IsAimingAtTank = true;
                    break;
                }
                newShot.X += (float)Math.Sin(TurretAngle) * 2;
                newShot.Y += (float)Math.Cos(TurretAngle) * 2;
            }

            return ret;
        }