private double AngelToWayPoint(Car self, World world, Game game, Move move) { double nextWaypointX = (self.NextWaypointX + 0.5D) * game.TrackTileSize; double nextWaypointY = (self.NextWaypointY + 0.5D) * game.TrackTileSize; double speedModule = Math.Sqrt(self.SpeedX * self.SpeedX + self.SpeedY * self.SpeedY); double max = .32D; double delta = speedModule / MaxSpeed; double cornerTileOffset = max * delta * game.TrackTileSize; switch (world.TilesXY[self.NextWaypointX][self.NextWaypointY]) { case TileType.LeftTopCorner: nextWaypointX += cornerTileOffset; nextWaypointY += cornerTileOffset; break; case TileType.RightTopCorner: nextWaypointX -= cornerTileOffset; nextWaypointY += cornerTileOffset; break; case TileType.LeftBottomCorner: nextWaypointX += cornerTileOffset; nextWaypointY -= cornerTileOffset; break; case TileType.RightBottomCorner: nextWaypointX -= cornerTileOffset; nextWaypointY -= cornerTileOffset; break; } return self.GetAngleTo(nextWaypointX, nextWaypointY); }
public double GetImportance(Car self) { double result; switch (Type) { case BonusType.RepairKit: result = 0.4 - 0.6*(self.Durability - 1); break; case BonusType.PureScore: result = 2.0; break; case BonusType.OilCanister: if (self.OilCanisterCount == 0) result = 0.8; else if (self.OilCanisterCount == 1) result = 0.6; else result = 0.5; break; case BonusType.NitroBoost: result = 1.0; break; case BonusType.AmmoCrate: if (self.ProjectileCount <= 2) result = 1.0; else result = 0.8; break; default: throw new Exception("Unknown BonusType"); } return result; }
public PlayerContext(Car[] cars, World world) { this.cars = new Car[cars.Length]; Array.Copy(cars, this.cars, cars.Length); this.world = world; }
public ACar(Car original) { X = original.X; Y = original.Y; Speed = new Point(original.SpeedX, original.SpeedY); Angle = original.Angle; EnginePower = original.EnginePower; WheelTurn = original.WheelTurn; AngularSpeed = original.AngularSpeed; Original = original; OutOfMap = false; RemainingNitroTicks = original.RemainingNitroTicks; RemainingNitroCooldownTicks = original.RemainingNitroCooldownTicks; RemainingInactiveTicks = DurabilityObserver.ReactivationTime(original) - MyStrategy.world.Tick; Width = original.Width; Height = original.Height; if (original.Type == CarType.Buggy) { _carAccelerationUp = Const.Game.BuggyEngineForwardPower / original.Mass; _carAccelerationDown = Const.Game.BuggyEngineRearPower / original.Mass; } else { _carAccelerationUp = Const.Game.JeepEngineForwardPower / original.Mass; _carAccelerationDown = Const.Game.JeepEngineRearPower / original.Mass; } }
public SimulatedPosition(Car self, Game game) { this.game = game; position = new Vector(self.X,self.Y); speed = new Vector(self.SpeedX,self.SpeedY); enginePower = self.EnginePower; }
public static void Watch(Car car) { if (IsActive(car)) { _remainTicks.Remove(car.Id); return; } if (!_remainTicks.ContainsKey(car.Id)) _remainTicks[car.Id] = MyStrategy.world.Tick; }
public void Move(Car self, World world, Game game, Move move) { move.EnginePower = 1.0D; move.IsThrowProjectile = true; move.IsSpillOil = true; if (world.Tick > game.InitialFreezeDurationTicks) { move.IsUseNitro = true; } }
public void Move(Car self, World world, Game game, Move move) { double nextWaypointX = (self.NextWaypointX + 0.5) * game.TrackTileSize; double nextWaypointY = (self.NextWaypointY + 0.5) * game.TrackTileSize; Console.WriteLine (self.NextWaypointX + " " + self.NextWaypointY); double cornerTileOffset = 0.25D * game.TrackTileSize; switch (world.TilesXY [self.NextWaypointX] [self.NextWaypointY]) { case TileType.LeftTopCorner: nextWaypointX += cornerTileOffset; nextWaypointY += cornerTileOffset; break; case TileType.RightTopCorner: nextWaypointX -= cornerTileOffset; nextWaypointY += cornerTileOffset; break; case TileType.LeftBottomCorner: nextWaypointX += cornerTileOffset; nextWaypointY -= cornerTileOffset; break; case TileType.RightBottomCorner: nextWaypointX -= cornerTileOffset; nextWaypointY -= cornerTileOffset; break; } double angleToWaypoint = self.GetAngleTo (nextWaypointX, nextWaypointY); double speedModule = hypot (self.SpeedX, self.SpeedY); move.WheelTurn = (angleToWaypoint * 32.0D / System.Math.PI); move.EnginePower = (1.0D); if (speedModule > 30) move.EnginePower = 0; if (speedModule * speedModule * System.Math.Abs (angleToWaypoint) > 2.5D * 2.5D * System.Math.PI) { move.EnginePower = (0.0D); if (speedModule > 10) { move.IsBrake = true; if (angleToWaypoint > 0) move.WheelTurn = 1; else move.WheelTurn = -1; } } move.IsThrowProjectile = true; move.IsSpillOil = true; }
public Points GetAlternativeWaySegments(Car car) { var result = new Points(); var myCell = GetCell(car.X, car.Y); result.Add(new Point(car)); Cell prevCell = null; var passedWayPoints = new List<Cell>(); for (var e = 1; result.Count < 5; e++) { var nextWp = GetNextWayPoint(car, e); for (var curCell = myCell; !curCell.Equals(nextWp); ) { var nextCell = DijkstraNextCell(curCell, nextWp, prevCell == null ? new Cell[] { } : new[] { prevCell }); var nextCenter = GetCenter(nextCell); for (var i = 0; i < result.Count; i++) { if (CheckVisibilityAndWp(car, result[i], nextCenter, passedWayPoints)) { result.RemoveRange(i + 1, result.Count - i - 1); break; } } result.Add(nextCenter); prevCell = curCell; curCell = nextCell; } myCell = nextWp; passedWayPoints.Add(nextWp); } var extended = ExtendWaySegments(result, 100); result.Clear(); passedWayPoints.Clear(); foreach (var t in extended) { if (result.Count > 0 && result.Last().Equals(t)) continue; if (GetNextWayPoint(car).Equals(GetCell(t))) passedWayPoints.Add(GetCell(t)); while (result.Count > 1 && CheckVisibilityAndWp(car, result[result.Count - 2], t, passedWayPoints)) result.Pop(); result.Add(t); } return result; }
public static ACar[] GetCarPath(Car self, Moves stack) { if (stack == null) return null; stack = stack.Clone(); var res = new List<ACar>(); var model = new ACar(self); while (stack.Count > 0) { var m = stack[0]; AMove.ModelMove(model, m, new PassedInfo(), Bonuses, OilSlicks, Tires, Others); m.Times--; stack.Normalize(); res.Add(model.Clone()); } return res.ToArray(); }
public static bool CheckVisibilityAndWp(Car car, Point from, Point to, List<Cell> wayPoints) { wayPoints = wayPoints.GetRange(0, wayPoints.Count); if (!EnumeratePointsBetween(from, to, 10.0, point => { if (IntersectTail(point, car.Height / 2 + 5)) return false; var cell = GetCell(point); if (wayPoints.Count > 0 && cell.Equals(wayPoints[0])) wayPoints.RemoveAt(0); return true; })) { return false; } return wayPoints.Count == 0; }
public void Move(Car self, World world, Game game, Move move) { double nextWaypointX = (self.NextWaypointX + 0.5D) * game.TrackTileSize; double nextWaypointY = (self.NextWaypointY + 0.5D) * game.TrackTileSize; double angleToWaypoint = self.GetAngleTo(nextWaypointX, nextWaypointY); if (backNumber < maxBackNumber) { backNumber++; move.WheelTurn = -oldAngle; move.EnginePower = -1; number = -100; return; } double speedModule = Math.Sqrt(self.SpeedX * self.SpeedX + self.SpeedY * self.SpeedY); if (Math.Abs(speedModule) < .05) number++; else number = 0; if (number > maxNumber) { backNumber = 0; number = 0; oldAngle = angleToWaypoint * 32.0D / Math.PI; } move.EnginePower = 1; if (Math.Abs(nextWaypointX - self.X) < 1600 && Math.Abs(nextWaypointY - self.Y) < 1600) { angleToWaypoint = AngelToWayPoint(self, world, game, move); move.IsBrake = IsUseBreak(self, world, game, move); } move.WheelTurn = angleToWaypoint * 32.0D / Math.PI; Console.WriteLine(String.Format("{0} - {1}", self.SpeedX, self.SpeedY)); move.IsUseNitro = IsUseNitro(self, world, game, move); move.IsThrowProjectile = IsThrow(self, world, game, move); move.IsSpillOil = IsSpillOil(self, world, game, move); veryOldTileType = oldTileType; oldTileType = world.TilesXY[self.NextWaypointX][self.NextWaypointY]; Console.WriteLine(speedModule); }
public World(int tick, int tickCount, int lastTickIndex, int width, int height, Player[] players, Car[] cars, Projectile[] projectiles, Bonus[] bonuses, OilSlick[] oilSlicks, string mapName, TileType[][] tilesXY, int[][] waypoints, Direction startingDirection) { this.tick = tick; this.tickCount = tickCount; this.lastTickIndex = lastTickIndex; this.width = width; this.height = height; this.players = new Player[players.Length]; Array.Copy(players, this.players, players.Length); this.cars = new Car[cars.Length]; Array.Copy(cars, this.cars, cars.Length); this.projectiles = new Projectile[projectiles.Length]; Array.Copy(projectiles, this.projectiles, projectiles.Length); this.bonuses = new Bonus[bonuses.Length]; Array.Copy(bonuses, this.bonuses, bonuses.Length); this.oilSlicks = new OilSlick[oilSlicks.Length]; Array.Copy(oilSlicks, this.oilSlicks, oilSlicks.Length); this.mapName = mapName; this.tilesXY = new TileType[tilesXY.Length][]; for (int i = tilesXY.Length - 1; i >= 0; --i) { this.tilesXY[i] = new TileType[tilesXY[i].Length]; Array.Copy(tilesXY[i], this.tilesXY[i], tilesXY[i].Length); } this.waypoints = new int[waypoints.Length][]; for (int i = waypoints.Length - 1; i >= 0; --i) { this.waypoints[i] = new int[waypoints[i].Length]; Array.Copy(waypoints[i], this.waypoints[i], waypoints[i].Length); } this.startingDirection = startingDirection; }
public ACar(ACar car) { X = car.X; Y = car.Y; Original = car.Original; Speed = car.Speed.Clone(); Angle = car.Angle; EnginePower = car.EnginePower; WheelTurn = car.WheelTurn; AngularSpeed = car.AngularSpeed; OutOfMap = car.OutOfMap; RemainingNitroTicks = car.RemainingNitroTicks; RemainingNitroCooldownTicks = car.RemainingNitroCooldownTicks; RemainingInactiveTicks = car.RemainingInactiveTicks; Width = car.Width; Height = car.Height; _carAccelerationUp = car._carAccelerationUp; _carAccelerationDown = car._carAccelerationDown; }
public void Move(Car self, World world, Game game, Move move) { Debug.beginPost(); Constants.setConstants(game, world); currentTick = world.Tick; if (map == null) { waypoints = world.Waypoints; map = new RoadMap(world.Width, world.Height); map.updateMap(world.TilesXY); } if (currentVehicle == null) { currentVehicle = new ManagedVehicle(); } currentVehicle.setCar(self); currentVehicle.tick(move); Debug.endPost(); }
public Points GetWaySegments(Car car) { var result = new Points(); var isWayPoint = new List<bool>(); var myCell = GetCell(car.X, car.Y); result.Add(new Point(car)); isWayPoint.Add(false); Cell prevCell = null; for (var e = 1; result.Count < 5; e++) { var nextWp = GetNextWayPoint(car, e); for (var curCell = myCell; !curCell.Equals(nextWp);) { var nextCell = DijkstraNextCell(curCell, nextWp, prevCell == null ? new Cell[] { } : new[] { prevCell }); var nextPoint = GetCenter(nextCell); while (result.Count > 1 && !isWayPoint[isWayPoint.Count - 1] && CheckVisibility(car, result[result.Count - 2], nextPoint, car.Height / 2 + 10)) { result.Pop(); isWayPoint.RemoveAt(isWayPoint.Count - 1); } result.Add(nextPoint); isWayPoint.Add(nextCell.Equals(nextWp)); prevCell = curCell; curCell = nextCell; } myCell = nextWp; } return result; }
public static bool CheckVisibility(Car car, Point from, Point to, double width) { return EnumeratePointsBetween(from, to, 10.0, point => !IntersectTail(point, width)); }
public static void DrawWays(Car self, Moves[] stacks, int sel) { if (stacks.Length > 0) DrawWay(self, stacks[0], Brushes.BlueViolet, sel == 0 ? 2 : 0); if (stacks.Length > 1) DrawWay(self, stacks[1], Brushes.Red, sel == 1 ? 2 : 0); if (stacks.Length > 2) DrawWay(self, stacks[2], Brushes.DeepPink, sel == 2 ? 2 : 0); if (stacks.Length > 3) DrawWay(self, stacks[3], Brushes.Black, sel == 3 ? 2 : 0); if (stacks.Length > 4) DrawWay(self, stacks[4], Brushes.SpringGreen, sel == 4 ? 2 : 0); if (stacks.Length > 5) DrawWay(self, stacks[5], Brushes.Coral, sel == 5 ? 2 : 0); if (stacks.Length > 6) DrawWay(self, stacks[6], Brushes.DarkGreen, sel == 6 ? 2 : 0); if (stacks.Length > 7) DrawWay(self, stacks[7], Brushes.DarkGreen, sel == 7 ? 2 : 0); if (stacks.Length > 8) DrawWay(self, stacks[8], Brushes.Black, sel == 8 ? 2 : 0); if (stacks.Length > 9) throw new NotImplementedException("Please select color for this path"); }
public static void DrawWay(Car self, Moves stack, Brush brush, double width) { if (stack == null) return; var pts = new Points(); pts.AddRange(MyStrategy.GetCarPath(self, stack).Select(car => new Point(car))); SegmentsDrawQueue.Add(new object[] { brush, pts, width }); }
public static bool IsCrashed(Car car) { return Players[car.PlayerId].IsStrategyCrashed; }
public void Move(Car self, World world, Game game, Move move) { lastX1 = lastX2; lastX2 = lastX3; lastX3 = Math.Round(self.X, 2); lastY1 = lastY2; lastY2 = lastY3; lastY3 = Math.Round(self.Y, 2); this._game = game; this._move = move; this._self = self; this._world = world; if (rearMove) { move.EnginePower = -1.0D; move.WheelTurn = 0;//(activeTicks > 50) ? -1 : 0; } if (activeTicks == 90 && Math.Abs (lastX1 - lastX3) < 0.05 && Math.Abs (lastY1 - lastY3) < 0.05 && _world.Tick > _game.InitialFreezeDurationTicks) rearMove = false; if (activeTicks > 0) { activeTicks --; return; } if (noStuck > 0) noStuck--; if (slowDown > 0) { move.EnginePower = 0.5D; } else move.EnginePower = 1.0D; if (noIgnite > 0) { noIgnite--; //return; } move.IsThrowProjectile = false; move.IsSpillOil = false; if (world.Tick > game.InitialFreezeDurationTicks && world.Tick < game.InitialFreezeDurationTicks + 10) { move.WheelTurn = -15; } if (world.Tick > game.InitialFreezeDurationTicks && world.Tick < game.InitialFreezeDurationTicks + 20) { // move.IsSpillOil = true; // move.WheelTurn = 0; sDirection = world.StartingDirection; } if (world.Tick > game.InitialFreezeDurationTicks && world.Tick < game.InitialFreezeDurationTicks + 10 && move.WheelTurn == 0) { // move.WheelTurn = 1; } if (world.Tick > game.InitialFreezeDurationTicks + 30) { move.IsUseNitro = (noIgnite == 0); CheckTurn(); NewTurnWheel (); CheckStuck (); if (Math.Abs(_move.WheelTurn) > Math.PI / 6) move.IsUseNitro = false; } if (_thisTile != TileType.Empty) { // saveDirection = sDirection; } }
private bool IsUseBreak(Car self, World world, Game game, Move move) { double speedModule = Math.Sqrt(self.SpeedX * self.SpeedX + self.SpeedY * self.SpeedY); switch (world.TilesXY[self.NextWaypointX][self.NextWaypointY]) { case TileType.LeftBottomCorner: case TileType.LeftTopCorner: case TileType.RightBottomCorner: case TileType.RightTopCorner: if (speedModule > MaxSpeed) { move.EnginePower = .8d; return true; } break; default: return false; } return false; }
public void Move(Car self, World world, Game game, Move move) { if (stop) return; if (world.Tick == 0) { startX = self.X; startY = self.Y; prevX = self.X; prevY = self.Y; } move.EnginePower = 0; if (world.Tick > game.InitialFreezeDurationTicks) { double nextWaypointX = (self.NextWaypointX + 0.5D) * game.TrackTileSize; double nextWaypointY = (self.NextWaypointY + 0.5D) * game.TrackTileSize; double angleToWaypoint = self.GetAngleTo(nextWaypointX, nextWaypointY); double distToWaypoint = self.GetDistanceTo(nextWaypointX, nextWaypointY); double speedModule = Math.Sqrt(self.SpeedX * self.SpeedX + self.SpeedY * self.SpeedY); travelled += self.GetDistanceTo(prevX, prevY); travelled2 += self.GetDistanceTo(prevX, prevY); prevX = self.X; prevY = self.Y; move.EnginePower = 1; if (travelled > 1500) { move.EnginePower = 0; if (self.EnginePower == 0) { if (t == -10) { travelled2 = 0; Console.WriteLine("S: {0},{1} {2}", self.X, self.Y, self.SpeedY); t = 1; SimulatedControl ctrl = new SimulatedControl(); ctrl.enginePower = move.EnginePower; pos = simulator.Simulate(t, 1, self, world, game, ctrl); Console.WriteLine("P: {0},{1} {2}", pos.position.X, pos.position.Y, pos.speed.Y); } else if (t > 1) { t--; } else if (t == 1) { t--; Console.WriteLine("R: {0},{1} {2}", self.X, self.Y, self.SpeedY); Console.WriteLine("%: {0} / {1} ({2})", travelled2, self.GetDistanceTo(pos.position.X, pos.position.Y), 100 * self.GetDistanceTo(pos.position.X, pos.position.Y) / travelled2); } } } } }
public void setCar(Car car) { this.car = car; }
private bool IsSpillOil(Car self, World world, Game game, Move move) { int currentTileX = (int)(self.X / game.TrackTileSize); int currentTileY = (int)(self.Y / game.TrackTileSize); switch (world.TilesXY[currentTileX][currentTileY]) { case TileType.LeftBottomCorner: case TileType.LeftTopCorner: case TileType.RightBottomCorner: case TileType.RightTopCorner: return true; default: return false; } }
void Initialize() { if (!Const.Initialized) { Const.Initialized = true; Const.TileSize = Const.Game.TrackTileSize; Const.TileMargin = Const.Game.TrackTileMargin; Const.CarDiagonalHalfLength = Geom.Gypot(Const.Game.CarWidth, Const.Game.CarHeight) / 2; Const.BonusDiagonalHalfLength = Geom.Gypot(Const.Game.BonusSize / 2 - MagicConst.BonusSafeMargin, Const.Game.BonusSize / 2 - MagicConst.BonusSafeMargin); Const.MapWidth = Const.TileSize * world.Width; Const.MapHeight = Const.TileSize * world.Height; } Teammate = world.Cars.FirstOrDefault(car => car.IsTeammate && car.Id != self.Id); ComputedPath.Remove(self.Id); if (Teammate != null) TeammateCar = ComputedPath.ContainsKey(Teammate.Id) ? ComputedPath[Teammate.Id] : null; if (Players == null) // check for first call { MyTiles = new ATile[world.Height, world.Width]; for (var i = 0; i < world.Height; i++) for (var j = 0; j < world.Width; j++) MyTiles[i, j] = new ATile(i, j, TileType.Unknown); } // intialize tiles var t = world.TilesXY; for (var i = 0; i < world.Height; i++) { for (var j = 0; j < world.Width; j++) { if (MyTiles[i, j].Type == TileType.Unknown && t[j][i] != TileType.Unknown) MyTiles[i, j] = new ATile(i, j, t[j][i]); MyTiles[i, j].Weight = 0; } } // intialize waypoints var wp = world.Waypoints; Waypoints = new Cell[wp.Length]; for(var i = 0; i < Waypoints.Length; i++) Waypoints[i] = new Cell(wp[i][1], wp[i][0]); Players = new Dictionary<long, Player>(); foreach (var player in world.Players) Players[player.Id] = player; foreach (var car in world.Cars) { DurabilityObserver.Watch(car); } var tires = world.Projectiles.Where(x => x.Type == ProjectileType.Tire).ToArray(); Tires = new AProjectile[tires.Length][]; #if DEBUG var trajectories = Tires.Select(x => new Points()).ToArray(); #endif for (var i = 0; i < tires.Length; i++) { Tires[i] = new AProjectile[MagicConst.ProjectilePredictionTicks]; Tires[i][0] = new AProjectile(tires[i]); for (var j = 1; j < MagicConst.ProjectilePredictionTicks; j++) { Tires[i][j] = Tires[i][j - 1].Clone(); Tires[i][j].Move(); #if DEBUG trajectories[i].Add(new Point(Tires[i][j])); #endif } } #if DEBUG foreach (var tr in trajectories) Visualizer.SegmentsDrawQueue.Add(new object[] {Brushes.Indigo, tr, 0.0}); #endif Bonuses = world.Bonuses.Select(b => new ABonus(b)).ToArray(); OilSlicks = world.OilSlicks.Select(s => new AOilSlick(s)).ToArray(); EnumerateNeigbours(GetCell(self), to => { var center = GetCenter(to); MyTiles[to.I, to.J].Weight += Math.Abs(self.GetAngleTo(center.X, center.Y)); }); foreach (var bonus in Bonuses) { var cell = GetCell(bonus); MyTiles[cell.I, cell.J].AddBonus(bonus); } foreach (var slick in OilSlicks) { var cell = GetCell(slick); MyTiles[cell.I, cell.J].AddSlick(slick); } Opponents = world.Cars.Where(car => !car.IsTeammate && !car.IsFinishedTrack).ToArray(); PrepareOpponentsPath(); if (OpponentsCars != null) Others = OpponentsCars .Concat(TeammateCar == null ? new ACar[][] { } : new[] { TeammateCar }) .ToArray(); ComputedPath.Clear(); if (self.TeammateIndex == 1 && OpponentsCars != null) { foreach (var opp in OpponentsCars) ComputedPath[opp[0].Original.Id] = opp; } }
private bool IsThrow(Car self, World world, Game game, Move move) { int maxShootDistance = 1000; if (self.ProjectileCount <= 0) { return false; } foreach (Car c in world.Cars) { if (c.IsTeammate) { continue; } double enemyCarAngel = self.GetAngleTo(c.X, c.Y); Console.WriteLine(self.GetDistanceTo(c)); if (self.GetDistanceTo(c) > maxShootDistance) { continue; } if (Math.Abs(enemyCarAngel) < 0.1) { return true; } } return false; }
public static Cell GetNextWayPoint(Car car, int delta = 1) { return Waypoints[(car.NextWaypointIndex + delta - 1) % Waypoints.Length]; }
public void Move(Car self, World world, Game game, Move move) { TimerStart(); MyStrategy.world = world; Const.Game = game; this.move = move; this.self = self; Initialize(); #if DEBUG while (Visualizer.Pause) { // pause here } Visualizer.CreateForm(world.Cars.Count(x => x.IsTeammate)); #endif if (!self.IsFinishedTrack) { All = null; MyTeam = null; _move(); if (OpponentsCars != null) { var myTeam = new List<ACar[]>(); if (!ComputedPath.ContainsKey(self.Id)) ComputedPath[self.Id] = new int[MagicConst.OpponentsTicksPrediction].Select(x => new ACar(self)).ToArray(); myTeam.Add(ComputedPath[self.Id]); if (TeammateCar != null) myTeam.Add(TeammateCar); MyTeam = myTeam.ToArray(); All = MyTeam.Concat(OpponentsCars).ToArray(); TimerStart(); if (CheckUseProjectile()) move.IsThrowProjectile = true; if (CheckUseOil()) move.IsSpillOil = true; TimerEndLog("CheckUseProjectile", 2); } } else if (_finishTime == Infinity) _finishTime = world.Tick; if (_finishTime < Infinity) Log(_finishTime); #if DEBUG if (move.IsBrake) Visualizer.CircleFillQueue.Add(new Tuple<Brush, ACircularUnit>(Brushes.Red, new ACircularUnit {X = self.X, Y = self.Y, Radius = 30})); TimerEndLog("All"); if (Brutes != null) { for (var i = 0; i < Brutes.Length; i++) { var info = Brutes[i].GetMaxTicksInfo(); if (info == null) continue; Console.Write(i + ": "); foreach (var a in info) Console.Write(" " + a); Console.WriteLine("(" + Brutes[i].SelectedCount + ")"); } } Console.WriteLine(); Visualizer.Draw(); Thread.Sleep(12); #endif }
private bool IsUseNitro(Car self, World world, Game game, Move move) { int currentTileX = (int)(self.X / game.TrackTileSize); int currentTileY = (int)(self.Y / game.TrackTileSize); switch (world.TilesXY[self.NextWaypointX][self.NextWaypointY]) { case TileType.LeftBottomCorner: case TileType.LeftTopCorner: case TileType.RightBottomCorner: case TileType.RightTopCorner: return false; } switch (world.TilesXY[currentTileX][currentTileY]) { case TileType.Crossroads: case TileType.Horizontal: case TileType.Vertical: return true; default: return false; } }