public override PirateLogic AttackBaseLogic() { AsteroidDodger asteroidDodger = new AsteroidDodger((ast, p) => { Squad PossibleTargets = Bot.Engine.EnemyLivingPirates.Filter(enemy => { Line l = new Line(enemy, ast); bool ShouldPush = !l.IsProjectionOnLine(p) || l.Distance(p) > ast.Size * 1.5; return(ShouldPush); }); if (!PossibleTargets.IsEmpty()) { return(PossibleTargets.FirstBy(x => x.Distance(ast)).Location); } else { return(AsteroidDodger.TangentPush(ast, p)); } } ); EmergencyCapsulePusherPlugin emergencyCapsulePusher = new EmergencyCapsulePusherPlugin(); PortalOptimizer portalOptimizer = new PortalOptimizer(); return(new PirateLogic(bomber, asteroidDodger, emergencyCapsulePusher, portalOptimizer)); }
public PirateLogic BaseLogic() { AsteroidDodger dodger = new AsteroidDodger(); PirateLogic logic = new PirateLogic(dodger); return(logic); }
public override PirateLogic DefenseBaseLogic() { AsteroidDodger dodger = new AsteroidDodger(); PirateLogic logic = new PirateLogic(dodger); return(logic); }
public LogicedPirateSquad[] AssignSquads(PirateShip[] pirates) { // Private cases if (Bot.Engine.Enemy.BotName == "25767") { DefensePushMapper = (obj, attackers) => { PushMapping pm = (obj is Pirate && ((Pirate)obj).HasCapsule()) ? Bot.Engine.DefaultPush(obj, attackers, true) : Bot.Engine.DefaultPush(obj, attackers); return(new PushMapping(pm.attackers, new Location(Bot.Engine.Rows - pm.dest.Row, Bot.Engine.Cols - pm.dest.Col))); } } ; // Initialize BaseLogic AttackBaseLogic = new PirateLogic().AttachPlugin(new Week3Custom.EtgarimWeek3Plugin()).AttachPlugin(new AsteroidDodger((ast, p) => { /* * Location nm = Bot.Engine.MyMotherships.Nearest(p).Location; * Line l = new Line(ast, nm); * return l.IsProjectionOnLine(p) ? AsteroidDodger.TangentPush(ast, p) : nm; */ Squad PossibleTargets = Bot.Engine.EnemyLivingPirates.Filter(enemy => { Line l = new Line(enemy, ast); bool ShouldPush = !l.IsProjectionOnLine(p) || l.Distance(p) > ast.Size * 1.5; return(ShouldPush); }); if (!PossibleTargets.IsEmpty()) { return(PossibleTargets.FirstBy(x => x.Distance(ast)).Location); } else { return(AsteroidDodger.TangentPush(ast, p)); } } )) .AttachPlugin(new EmergencyCapsulePusherPlugin()).AttachPlugin(new PortalOptimizer()); DefenseBaseLogic = new PirateLogic().AttachPlugin(new Week3Custom.EtgarimWeek3Plugin()).AttachPlugin(new AsteroidDodger((ast, p) => { Squad PossibleTargets = Bot.Engine.EnemyLivingPirates.Filter(enemy => { Line l = new Line(enemy, ast); bool ShouldPush = !l.IsProjectionOnLine(p) || l.Distance(p) > ast.Size * 1.5; return(ShouldPush); }); if (!PossibleTargets.IsEmpty()) { return(PossibleTargets.FirstBy(x => x.Distance(ast)).Location); } else { return(AsteroidDodger.TangentPush(ast, p)); } })) .AttachPlugin(new EmergencyCapsulePusherPlugin()); // Not good practice pirates = Bot.Engine.MyPirates.ToArray(); Tuple <int, int> Sizes = AssignSizes(); int AttackSize = Sizes.arg0; int DefenseSize = Sizes.arg1; Squad AttackSquad = new Squad(pirates.Where(x => x.Id < AttackSize)); Squad DefenseSquad = new Squad(pirates.Where(x => x.Id >= AttackSize)); LogicedPirateSquad[] AttackerPirates = LogicAttackers(AttackSquad); LogicedPirateSquad[] DefenderPirates = LogicDefenders(DefenseSquad); Bot.Engine.Debug("Testing pirates..."); // Not good practice return(AttackerPirates.Concat(DefenderPirates).Select(x => { Bot.Engine.Debug(new Squad(x.LogicedPirates.Select(y => y.pirate))); return new LogicedPirateSquad(x.LogicedPirates.Where(y => y.pirate.Alive).ToArray(), x.Logic); }).ToArray()); }