Esempio n. 1
0
        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)));
        }
Esempio n. 2
0
        public override AgentAction MakeMove()
        {
            myTile = map.Values.First(x => x.IsPlayer);

            if (map.BlastZones.ContainsKey(myTile))
            {
                if (map.BlastZones[myTile] <= 2)
                {
                    return(GameLib.GetRandomSafeDirection(map, myTile));
                }
            }

            if (!info.BombAvailable)
            {
                return(GameLib.GetRandomSafeDirection(map, myTile));
            }

            var graph = map.ToFullGraph().DeleteTiles(x => !x.IsWalkable);

            pathfinder.FindAllPaths(graph, myTile);

            var a = GameLib.GetWalkableTilesAroundBlast(map, myTile);

            if (a.Count != 0)
            {
                return(PlantBomb(a));
            }

            return(GameLib.GetRandomSafeDirection(map, myTile));
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        private AgentAction PlantBomb(HashSet <Tile> safeTiles)
        {
            var tileTo = pathfinder.NextTileOnPath(safeTiles.OrderBy(x => pathfinder.GetDistance(x)).First());

            return(GameLib.BombDirectionTo(myTile, tileTo));
        }