double ProbabStrikeAfter(int swingTime, Hockeyist self, IEnumerable <MoveAction> actions, ActionType actionType) { var I = new AHock(self); if (Math.Abs(My.NetFront - I.X) < RinkWidth / 3) { return(0.0); } var power = GetPower(I, swingTime); var totalTime = 0; var opps = Hockeyists .Where(x => !x.IsTeammate && IsInGame(x)) .Select(x => new AHock(x)) .ToArray(); var goalie = Get(OppGoalie); foreach (var action in actions) { for (var i = 0; i < action.Ticks; i++) { GoalieMove(goalie, 1, I.PuckPos()); I.Move(action.SpeedUp, action.Turn); if (!Chase(opps, I)) { return(0.0); } } totalTime += action.Ticks; } var passAngle = PassAngleNorm(I.GetAngleTo(GetStrikePoint())); return(StrikeProbability(I, power, goalie, totalTime, actionType, passAngle, null)); }
// Проверка движение хоккеиста void Research3(Hockeyist self) { var range = TurnRange(new AHock(self).AAgility); move.Turn = range / 2; move.SpeedUp = 0.8; var pl = new AHock(self); pl.Move(0.8, range / 2, 20); }
public int GetTicksToDownN(AHock ho, Point to, double takePuck = -1, int limit = 300) { var result = 0; for (; result < limit && (takePuck < 0 ? !CanStrike(ho, to) : ho.GetDistanceTo2(to) > takePuck * takePuck); result++) { var turn = RevAngle(ho.GetAngleTo(to)); var speedUp = -GetSpeedTo(turn); ho.Move(speedUp, TurnNorm(turn, ho.AAgility)); } return result >= limit ? Inf : result; }
public int GetTicksToDownN(AHock ho, Point to, double takePuck = -1, int limit = 300) { var result = 0; for (; result < limit && (takePuck <0 ? !CanStrike(ho, to) : ho.GetDistanceTo2(to)> takePuck * takePuck); result++) { var turn = RevAngle(ho.GetAngleTo(to)); var speedUp = -GetSpeedTo(turn); ho.Move(speedUp, TurnNorm(turn, ho.AAgility)); } return(result >= limit ? Inf : result); }
Point PuckMove(int ticks, APuck pk, AHock hock) { if (hock == null) { pk.Move(ticks); return(new Point(pk)); } if (Math.Abs(hock.GetAngleTo(hock + hock.Speed)) < Deg(15) && hock.Speed.Length > 2) { hock.Move(1, 0, ticks); // TODO } return(hock.PuckPos()); }
double ProbabStrikeAfter(int swingTime, Hockeyist self, IEnumerable<MoveAction> actions, ActionType actionType) { var I = new AHock(self); if (Math.Abs(My.NetFront - I.X) < RinkWidth / 3) return 0.0; var power = GetPower(I, swingTime); var totalTime = 0; var opps = Hockeyists .Where(x => !x.IsTeammate && IsInGame(x)) .Select(x => new AHock(x)) .ToArray(); var goalie = Get(OppGoalie); foreach (var action in actions) { for (var i = 0; i < action.Ticks; i++) { GoalieMove(goalie, 1, I.PuckPos()); I.Move(action.SpeedUp, action.Turn); if (!Chase(opps, I)) return 0.0; } totalTime += action.Ticks; } var passAngle = PassAngleNorm(I.GetAngleTo(GetStrikePoint())); return StrikeProbability(I, power, goalie, totalTime, actionType, passAngle, null); }
// Проверка движение хоккеиста void Research3(Hockeyist self) { var range = TurnRange(new AHock(self).AAgility); move.Turn = range / 2; move.SpeedUp = 0.8; var pl = new AHock(self); pl.Move(0.8, range / 2, 20); }
Point PuckMove(int ticks, APuck pk, AHock hock) { if (hock == null) { pk.Move(ticks); return new Point(pk); } if (Math.Abs(hock.GetAngleTo(hock + hock.Speed)) < Deg(15) && hock.Speed.Length > 2) hock.Move(1, 0, ticks); // TODO return hock.PuckPos(); }