public override AgentAction MakeMove() { if (ShouldPanic()) { return(Panic()); } if (TargetInBombRadius(myTile) || MischiefChance()) { var tileToRun = GetTileToRunAfterBomb(); if (tileToRun != null) { return(GameLib.BombDirectionTo(myTile, pathfinder.NextTileOnPath(tileToRun.Value))); } } var target = ChooseTarget(); if (target == default) { //взрываем себя если всё равно на следующий ход СМЕРТ return(IsTileDeadlyToGo(myTile) ? AgentAction.BombUp : AgentAction.DoNothing); } return(GameLib.DirectionTo(myTile, pathfinder.NextTileOnPath(target))); }
private AgentAction Panic() { //Console.WriteLine("PANIC"); HashSet <Tile> viableTurns = map.GetAdjacentWalkableTiles(myTile) .Where(x => !IsTileDeadlyToGo(x)) .ToHashSet(); if (viableTurns.Count == 0) //Blown yourself up if you gonna die anyway { return(IsTileDeadlyToGo(myTile) ? AgentAction.BombUp : AgentAction.DoNothing); } if (viableTurns.Count == 1) { return(GameLib.DirectionTo(myTile, viableTurns.First())); } var finalTile = NotEnemiesBlastZonesOrInitial(NotDangerousOrInitial(viableTurns)) .MaxBy(EvaluateSimpleTileSafety) .First(); return(GameLib.DirectionTo(myTile, finalTile)); }