Beispiel #1
0
        static void Main()
        {
            var Competitions = new Gems.Levels.Level1();
            Competitions.HelloPackage = new HelloPackage { MapSeed = -1 };
            
            var CvarcRules = new GemsRules();
            var CvarcEngine = new CVARCEngine(CvarcRules);

            Competitions.Initialize(
                CvarcEngine,
                new[] { 
                    new RobotSettings(0, true), 
                    new RobotSettings(1, true) 
                });

            var bots = new[] 
            { 
                new SquareMovingBot(), 
                new SquareMovingBot()
            };

            var form = new TutorialForm(Competitions);

            new Thread(() => Competitions.ProcessParticipants(true, int.MaxValue, bots)) 
                { IsBackground = true }
                .Start();

            Application.Run(form);
        }
Beispiel #2
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);
        }
Beispiel #3
0
 private static void RunForm(Participant[] participants)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     var form = new TutorialForm(competitionsBundle.competitions);
     Task.Factory.StartNew(() => competitionsBundle.competitions.ProcessParticipants(true, 60 * 1000, participants));
     Application.Run(form);
 }
Beispiel #4
0
 private static void RunForm(Participant participant)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     form = new TutorialForm(competitionsBundle.competitions) {KeyPreview = true};
     form.KeyDown += (sender, e) => competitionsBundle.competitions.ApplyCommand(Controller.GetCommand(e.KeyCode));
     form.KeyUp += (sender, e) => competitionsBundle.competitions.ApplyCommand(Command.Sleep(0));
     Task.Factory.StartNew(() => competitionsBundle.competitions.ProcessParticipants(true, int.MaxValue, participant));
     Application.Run(form);
 }