private void goTo(EChars bot, double x, double y) { int id = getIdByName(bot); Bots[id].X = x; Bots[id].Y = y; }
private double nearestEnemy(EChars bot) { double min = 1000, dist; Bot mine = getBot(bot); foreach (Bot enemy in input.Enemy.Bots) { dist = botToPoint(enemy, mine.X, mine.Y); if (dist < min) { min = dist; } } return(min); }
private void passToNearest(EChars sender, params EChars[] bots) { double min = 1000, dist = 0; EChars receiver = EChars.Attacker; foreach (EChars bot in bots) { dist = botToPoint(sender, bot); if (dist < min) { receiver = bot; min = dist; } } pass(receiver); }
private bool hasBall(EChars bot) { return(getBot(bot).HasBall); }
private void pass(EChars bot) { Bot receiver = getBot(bot); kick(receiver.X, receiver.Y); }
private Bot getBot(EChars bot) { return(Bots[(int)bot]); }
private double botToPoint(EChars bot, double x, double y) { int id = getIdByName(bot); return(Math.Sqrt(Math.Pow(Bots[id].X - x, 2) + Math.Pow(Bots[id].Y - y, 2))); }
private double botToPoint(EChars bot1, EChars bot2) { Bot bot2r = getBot(bot2); return(botToPoint(bot1, bot2r.X, bot2r.Y)); }
private double botToPoint(EChars bot, bool to = true) { return(botToPoint(bot, input.Ball.GetX(to), input.Ball.GetY(to))); }
private void goTo(EChars bot, bool to = true) { goTo(bot, input.Ball.GetX(to), input.Ball.GetY(to)); }
private int getIdByName(EChars bot) { return((int)bot); }