/// <summary>
        /// Called once, at the start of omegaGo, just after Fuego registration, this creates the Fuego engine and associates it
        /// with this instance. That may take a long time so it's put in the Fuego queue as its first item. Called from the UI thread.
        /// </summary>
        public void AppWideInitialization()
        {
            var init = new FuegoAction(() =>
            {
                _engine = AISystems.FuegoBuilder.CreateEngine(0);
            });

            EnqueueAction(init);
        }
Exemple #2
0
        private void Initialize(AiGameInformation gameInformation)
        {
            this._engine = AISystems.FuegoBuilder.CreateEngine(gameInformation.GameInfo.BoardSize.Width);

            // Board size
            SendCommand("boardsize " + gameInformation.GameInfo.BoardSize.Width);


            // Rules
            switch (gameInformation.GameInfo.RulesetType)
            {
            case RulesetType.AGA:
            case RulesetType.Chinese:
                SendCommand("go_rules chinese");
                SendCommand("go_param_rules japanese_scoring 0");
                break;

            case RulesetType.Japanese:
                SendCommand("go_rules japanese");
                SendCommand("go_param_rules japanese_scoring 1");
                break;
            }
            SendCommand("komi " + gameInformation.GameInfo.Komi.ToString(CultureInfo.InvariantCulture));


            // Strength
            SendCommand("uct_param_player ponder " + (this.Ponder ? "1" : "0"));
            if (this.MaxGames > 0)
            {
                SendCommand("uct_param_player max_games " + this.MaxGames);
            }

            if (!this.AllowResign)
            {
                SendCommand("uct_param_player resign_threshold 0");
            }

            // TODO (future work) Petr: on IGS, make it so two passes don't end a game

            // Time settings
            string timeSettings = gameInformation.AiPlayer.Clock.GetGtpInitializationCommand();

            if (timeSettings != null)
            {
                SendCommand(timeSettings);
            }

            // Regardless of time controls, we are never willing to wait more than 15 seconds.
            SendCommand("go_param timelimit 15");

            // Print beginning info
            Note("Komi set to " + SendCommand("get_komi").Text);
            DebuggingNote("Random seed is " + SendCommand("get_random_seed").Text);
            SendCommand("go_param_rules");
        }