Beispiel #1
0
        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)
            });
        }
Beispiel #2
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);
        }