コード例 #1
0
        static void Main(string[] args)
        {
            var userSettings = Sc2SettingsFile.settingsFromUserDir();

            var instanceSettings = Instance.StartSettings.OfUserSettings(userSettings);

            Func <Instance.Sc2Instance> createInstance =
                () => Runner.run(Instance.start(instanceSettings));

            var participants = new Sc2Game.Participant[] {
                Sc2Game.Participant.CreateParticipant(
                    createInstance(),
                    Race.Terran,
                    (state => (IEnumerable <SC2APIProtocol.Action>) new SC2APIProtocol.Action[] {})),
                Sc2Game.Participant.CreateComputer(Race.Terran, Difficulty.Hard)
            };

            var gameSettings =
                Sc2Game.GameSettings.OfUserSettings(userSettings)
                .WithMap(@"Ladder2017Season1\AbyssalReefLE.SC2Map")
                .WithRealtime(true);

            // Runs the game to the end with the given bots / map and configuration
            Runner.run(Sc2Game.runGame(gameSettings, participants));
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: paweenwich/sc2
        public static void RunSC2()
        {
            var userSettings     = Sc2SettingsFile.settingsFromUserDir();
            var instanceSettings = Instance.StartSettings.OfUserSettings(userSettings);

            Func <Instance.Sc2Instance> createInstance =
                () => Runner.run(Instance.start(instanceSettings));

            var participants = new Sc2Game.Participant[] {
                Sc2Game.Participant.CreateParticipant(
                    createInstance(),
                    Race.Terran,
                    //(state => (IEnumerable<SC2APIProtocol.Action>)new SC2APIProtocol.Action[] {})),
                    MasterAgent_MainLoop),
                Sc2Game.Participant.CreateComputer(Race.Random, Difficulty.Hard)
            };

            var gameSettings =
                Sc2Game.GameSettings.OfUserSettings(userSettings)
                .WithMap(@"Simple64.SC2Map")
                //.WithRealtime(true)
                //.WithStepsize(10)
            ;

            //.WithRealtime(true);

            // Runs the game to the end with the given bots / map and configuration
            try
            {
                var obj = Sc2Game.runGame(gameSettings, participants);
                Runner.run(obj);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }