예제 #1
0
        /**
         * @param args args[0] Private key
         * @param args args[1] [training|arena]
         * @param args args[2] Game Id
         */

        private static void Main(string[] args)
        {
            if (args.Length < 2) {
                Console.WriteLine("Usage: myBot.exe key training|arena gameId|showbrowser");
                Console.WriteLine("gameId is used to show browser in training mode");
                Console.ReadKey();
                return;
            }

            string serverURL = "http://blitz2016.xyz:8080";
            string apiKey = args[0];
            bool trainingMode = args[1] == "training";
            string gameId = args.Length == 3 && !trainingMode ? args[2] : null;
            bool showBrowser = trainingMode && args.Length == 3;

            IBestChoice bestChoice = new EvenBestChoice();
            IPathfinder pathfinder = new Disjkstra();

            ISimpleBot bot;
            if (bestChoice != null && pathfinder != null) {
                bot = new BestBot(bestChoice, pathfinder);
            } else {
                bot = new RandomBot();
            }
            
			// add a random param to start browser in training mode
            SimpleBotRunner runner = new SimpleBotRunner(
                new ApiToolkit(serverURL, apiKey, trainingMode, gameId, 1200),
				bot,
                showBrowser);

            runner.Run();

            Console.Read();
        }
예제 #2
0
        /**
         * @param args args[0] Private key
         * @param args args[1] [training|arena]
         * @param args args[2] Game Id
         */

        private static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.WriteLine("Usage: myBot.exe key training|arena gameId|showbrowser");
                Console.WriteLine("gameId is used to show browser in training mode");
                Console.ReadKey();
                return;
            }

            string serverURL    = "http://blitz2016.xyz:8080";
            string apiKey       = args[0];
            bool   trainingMode = args[1] == "training";
            string gameId       = args.Length == 3 && !trainingMode ? args[2] : null;
            bool   showBrowser  = trainingMode && args.Length == 3;

            IBestChoice bestChoice = new EvenBestChoice();
            IPathfinder pathfinder = new Disjkstra();

            ISimpleBot bot;

            if (bestChoice != null && pathfinder != null)
            {
                bot = new BestBot(bestChoice, pathfinder);
            }
            else
            {
                bot = new RandomBot();
            }

            // add a random param to start browser in training mode
            SimpleBotRunner runner = new SimpleBotRunner(
                new ApiToolkit(serverURL, apiKey, trainingMode, gameId, 1200),
                bot,
                showBrowser);

            runner.Run();

            Console.Read();
        }