示例#1
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                //args = new[] { "87.224.245.130", "14001" };
                args = new[] { "127.0.0.1", "14000" }
            }
            ;
            var ip   = args[0];
            var port = int.Parse(args[1]);

            // Каждую неделю клиент будет новый. Соотетственно Level1, Level2 и Level3.
            var client = new PudgeClientLevel2();

            // У этого метода так же есть необязательные аргументы:
            // timeLimit -- время в секундах, сколько будет идти матч (по умолчанию 90)
            // operationalTimeLimit -- время в секундах, отображающее ваш лимит на операции в сумме за всю игру
            // По умолчанию -- 1000. На турнире будет использоваться значение 5. Подробнее про это можно прочитать в правилах.
            // isOnLeftSide -- предпочитаемая сторона. Принимается во внимание во время отладки. По умолчанию true.
            // seed -- источник энтропии для случайного появления рун. По умолчанию -- 0.
            // При изменении руны будут появляться в другом порядке
            // speedUp -- ускорение отладки в два раза. Может вызывать снижение FPS на слабых машинах

            var graph = JsonConvert.DeserializeObject <Graph>(string.Join("", File.ReadAllLines("graph.json")));
            var data  = client.Configurate(ip, port, CvarcTag);

            client.SensorDataReceived += Print;
            var mover = new Mover(graph, data, client);

            mover.Run(new FourSlardarsStrategy());
            client.Exit();
        }
    }
示例#2
0
        public static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                args = new[] { "127.0.0.1", "14000" }
            }
            ;
            var ip   = args[0];
            var port = int.Parse(args[1]);

            var trees     = ReadTrees("trees.json");
            var client    = new PudgeClientLevel2();
            var intellect = new PudgeIntellect(client, trees);

            var rnd = new Random();

            client.Configurate(ip, port, CvarcTag, seed: rnd.Next(), speedUp: true);
            intellect.Play();
            client.Exit();
        }
示例#3
0
 public Mover(Graph graph, PudgeSensorsData data, PudgeClientLevel2 client)
 {
     decider      = new Decider(graph, data, seenNetwork);
     pathFinder   = new PathFinder(graph);
     graphUpdater = new GraphUpdater(graph);
     graphUpdater.Update(data);
     this.graph     = graph;
     this.data      = data;
     this.client    = client;
     executeCommand = new Dictionary <string, Action <Command> >
     {
         { HookCommand.TypeName, x => ExecuteHook((x as HookCommand).Target) },
         { MoveCommand.TypeName, x => ExecuteMove((x as MoveCommand).Destination) },
         { WaitCommand.TypeName, x => ExecuteWait((x as WaitCommand).Time) },
         { LongMoveCommand.TypeName, x => ExecuteLongMove((x as LongMoveCommand).Destination) },
         { LongKillMoveCommand.TypeName, x => ExecuteLongKillMove((x as LongKillMoveCommand).Destination, out hooked) },
         { MoveAndReturnCommand.TypeName, x => ExecuteMoveAndReturn((x as MoveAndReturnCommand).Destination) },
         { HookAroundCommand.TypeName, x => ExecuteHookAround() },
         { MeetSlardarCommand.TypeName, x => ExecuteMeetSlardar((x as MeetSlardarCommand).Destination) }
     };
 }