예제 #1
0
        public void DistanceToCascade()
        {
            var mapCont = MapController.Instance;
            var aStar = new AStar( Map.Instance);
            int totalCost;
            var path = aStar.Star(new Helper.Point(19, 24), new Helper.Point(19, 14) , out totalCost);

            Console.WriteLine(String.Join("\n", path.Select(v =>  v.x.ToString() + ";" + v.y.ToString() ) ) );
            Console.WriteLine(totalCost);
            Assert.IsTrue(totalCost == 410);
        }
예제 #2
0
        public void DistanceToRainbow()
        {
            var mapCont = MapController.Instance;
            var aStar = new AStar( Map.Instance);
            int totalCost;

            var path = aStar.Star(new Helper.Point(19, 24), new Helper.Point(22, 2), out totalCost);

            Console.WriteLine(String.Join("\n", path.Select(v =>  v.x.ToString() + ";" + v.y.ToString() ) ) );
            Console.WriteLine(totalCost);
        }
예제 #3
0
        public void Walk()
        {
            var aStar = new AStar(Map.Instance);
            while (Map.Instance.Ash.PokeCount <= 149)
            {
                Helper.Action act;
                unsafe { act = Helper.GetAction(Prolog.BestMove()); }

                int totalCost;
                switch (act.move)
                {
                    case BestMove.Launch: mapCont.Ash.Pokeball(); break;
                    case BestMove.Heal: mapCont.Ash.HealPokemons(); break;
                    case BestMove.Buy: mapCont.Ash.BuyPokeballs(); break;
                    case BestMove.Battle:

                        if (act.win == false)
                        {
                            Prolog.Trainers();
                            mapCont.sw.Close();
                            throw new Exception(act.point.ToString());
                        }
                        else
                        mapCont.Ash.Battle(act.win,act.point);
                        break;
                    case BestMove.Move: updatePerceptions(act.point);  mapCont.StepAsh(act.point); break;
                    case BestMove.AStar :
                        var path = aStar.Star(Map.Instance.Ash.Pos, act.point, out totalCost) ;
                        mapCont.AshFromTo(path, updatePerceptions);
                        break;
                    case BestMove.TurnRight:
                    case BestMove.TurnLeft:
                        mapCont.TurnAsh(act.move); break;
                    case BestMove.Joker:
                        goto looser;
                        break;
                    case BestMove.KillGary:
                        var pathK = aStar.Star(Map.Instance.Ash.Pos, act.point, out totalCost) ;
                        //mapCont.Ash.Battle(true,act.point);
                        mapCont.AshFromTo(pathK, updatePerceptions);
                        Prolog.Trainers();
                        break;
                    case BestMove.GoPokeCenter:
                        var pathG = aStar.Star(Map.Instance.Ash.Pos, act.point, out totalCost) ;
                        mapCont.AshFromTo(pathG, updatePerceptions);

                        break;
                    case BestMove.CatchPokemon:
                        var pathC = aStar.Star(Map.Instance.Ash.Pos, act.point, out totalCost) ;
                        mapCont.AshFromTo(pathC, updatePerceptions);
                        break;
                    default:
                        break;
                }

            }
            looser:

            Prolog.ScreamsT();
            Prolog.Trainers();
            Prolog.Pokemons();
            Prolog.Safes();
            mapCont.sw.Close();
            mapCont.Ash.listenerInfo(mapCont.Ash);
            Console.WriteLine(mapCont.Ash.TotalCost);
        }
예제 #4
0
        public void DistanceToSoul()
        {
            var mapCont = MapController.Instance;
            var aStar = new AStar( Map.Instance);
            int totalCost;

            var path = aStar.Star(new Helper.Point(19, 24), new Helper.Point(2, 4) , out totalCost);

            Console.WriteLine(String.Join("\n", path.Select(v =>  v.x.ToString() + ";" + v.y.ToString() ) ) );
            for (int i = 0; i < path.Count; i++)
            {
                Helper.Point pos = path.ElementAt(i);

                Tile temp = Map.Instance.GetTile(pos.x, pos.y );
                Console.WriteLine(temp.TileType);
            }
            Console.WriteLine(totalCost);
            Assert.IsTrue(430 == totalCost);
        }
예제 #5
0
 public void DistanceToThunder()
 {
     var mapCont = MapController.Instance;
     var aStar = new AStar( Map.Instance);
     int totalCost;
     var path = aStar.Star(new Helper.Point(19, 24), new Helper.Point(2, 19),out totalCost);
     Assert.IsTrue(totalCost == 660);
 }