예제 #1
0
        static void Main()
        {
            var settings = new BotDemoSettings();
            try
            {
                CompetitionsBundle = CompetitionsBundle.Load(settings.CompetitionsName, "Level1");
                CompetitionsBundle.competitions.HelloPackage = new HelloPackage { MapSeed = -1 };
                CompetitionsBundle.competitions.Initialize(new CVARCEngine(CompetitionsBundle.Rules), new[] { new RobotSettings(0, true), new RobotSettings(0, true) });
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "CVARC BotDemo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            List<Bot> bots = new List<Bot>();
            for (int i = 0; i < CompetitionsBundle.competitions.RobotCount; i++)
            {
                if (i == settings.BotNames.Length) break;
                if (settings.BotNames[i] == "None") continue;
                bots.Add(CompetitionsBundle.competitions.CreateBot(settings.BotNames[i], i));
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var form = new TutorialForm(CompetitionsBundle.competitions);
            new Thread(() => CompetitionsBundle.competitions.ProcessParticipants(true, int.MaxValue, bots.ToArray())) { IsBackground = true }.Start();
            Application.Run(form);
        }
예제 #2
0
파일: Program.cs 프로젝트: DmitryZyr/CVARC
        static void Main(string[] args)
        {
            competitionsBundle = CompetitionsBundle.Load(CompetitionsName, "Level1");
            competitionsBundle.competitions.HelloPackage = new HelloPackage { MapSeed = 1 };
            competitionsBundle.competitions.Initialize(new CVARCEngine(competitionsBundle.Rules),
                new[] { new RobotSettings(0, false), new RobotSettings(1, true) });

            var botName = args.FirstOrDefault() ?? "None";
            RunForm(competitionsBundle.competitions.CreateBot(botName, 1));
        }
예제 #3
0
파일: Program.cs 프로젝트: DmitryZyr/CVARC
 private static void InitCompetition(HelloPackage helloPackage, string competitionsName)
 {
     var participantsServer = new ParticipantsServer(competitionsName);
     var participantsTask = Task.Factory.StartNew(() => participantsServer.GetParticipants(helloPackage));
     RunClients("player2\\Client.exe", "player1\\Client.exe");
     participants = participantsTask.Result;
     competitionsBundle = participantsServer.CompetitionsBundle;
     participantsServer.CompetitionsBundle.competitions.Initialize(new CVARCEngine(competitionsBundle.Rules), new[]
     {
         new RobotSettings(0, false), 
         new RobotSettings(1, false)
     });
 }
예제 #4
0
 private static Participant[] InitCompetition()
 {
     var participantsServer = new ParticipantsServer(CompetitionsName);
     var participant = participantsServer.GetParticipant();
     competitionsBundle = participantsServer.CompetitionsBundle;
     var participants = new Participant[2];
     participants[participant.ControlledRobot] = participant;
     var botNumber = participant.ControlledRobot == 0 ? 1 : 0;
     participantsServer.CompetitionsBundle.competitions.Initialize(new CVARCEngine(participantsServer.CompetitionsBundle.Rules),
         new[] { new RobotSettings(participant.ControlledRobot, false), new RobotSettings(botNumber, true) });
     var botName = participantsServer.CompetitionsBundle.competitions.HelloPackage.Opponent ?? "None";
     participants[botNumber] = participantsServer.CompetitionsBundle.competitions.CreateBot(botName, botNumber);
     return participants;
 }