Beispiel #1
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));
        }
Beispiel #2
0
 public void Setup()
 {
     GameField1 = string.Join("", GameField1.Split(default(string[]), StringSplitOptions.RemoveEmptyEntries));
     mapParser  = new MapParser(codes);
     map        = mapParser.ParseMapFromString(GameField1, new VectorInt2(8, 7));
     graph      = map.ToFullGraph();
     mind       = new Mastermind("");
     pathfinder = new DijkstraPathfinder();
     playerTile = map.Values.First(x => x.IsPlayer);
     pathfinder.FindAllPaths(graph, playerTile);
 }
Beispiel #3
0
        public Hunter(Map map, GameInfo info) : base(map, info)
        {
            this.map  = map;
            blastZone = map.BlastZones;
            this.info = info;
            myTile    = map.PlayerTile;

            var dangerousZone = blastZone.Where(x => x.Value == 1)
                                .Select(x => x.Key).ToHashSet();
            var graph = map.ToFullGraph()
                        .IncreaseWeightAround(x => x.IsMonster, 4)
                        .IncreaseWeightAround(x => blastZone.ContainsKey(x), 1, 2)
                        .IncreaseWeightAround(x => dangerousZone.Contains(x), 1, 1001)
                        .DeleteTiles(x => !x.IsWalkable);

            pathfinder.FindAllPaths(graph, myTile);
        }