Esempio n. 1
0
        public MainWindow()
        {
            InitializeComponent();

            m_app = (App)Application.Current;

            // initialise sounds
            m_playSound.Open(new Uri(@"sounds/stone.mp3", UriKind.RelativeOrAbsolute));
            m_bowlSound.Open(new Uri(@"sounds/bowl.mp3", UriKind.RelativeOrAbsolute));

            Uri iconUri = new Uri("pack://application:,,,/strasgo.ico", UriKind.RelativeOrAbsolute);
            this.Icon = BitmapFrame.Create(iconUri);

            IsDemonstration = false;

            system_message.Text = "";
            GtpEngineState = GtpState.none;

            m_engine = m_app.GtpEngine;
            m_engine.ResponsePushed += GtpEngine_ResponsePushed;
            m_engine.HasPlayed += GtpEngine_HasPlayed;
            m_engine.CommandPushed += GtpEngine_CommandPushed;

            GtpEngineState = m_colorToPlay != m_app.PlayerColor ? GtpState.thinking : GtpState.ready;

            m_app.GameIsOver += m_app_GameIsOver;

            IsGameRunning = false;

            // TODO save/load user settings!
            slider_handicap.Value = m_app.Game.GameInfo.Handicap;
            slider_time.Value = MainTimeForPachi;

            console_output.Text = String.Empty;
            debug_column.Visibility = Visibility.Hidden;

            capturedPanel.Visibility = System.Windows.Visibility.Collapsed;

            radio_9.IsChecked = true;

            displayMenuOverlay();
            InitUI(MainTimeForPachi);

            // init tick for clock update
            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds( 1 );
            timer.Tick += timer_Tick;
            timer.Start();

            this.KeyUp += MainWindow_KeyUp;
        }
Esempio n. 2
0
 void GtpEngine_ResponsePushed(object sender, GoEngineWrapper.ResponseEventArgs e)
 {
 }
Esempio n. 3
0
        public void StartPachi()
        {
            // create process
            // if we need an AI
            try
            {
                if (m_gtpEngine == null)
                {
                    GoEngineWrapper.Parameters param;
                    param.name = "Pachi UTC";
                    param.filename = "pachi.exe";
                    param.arguments = "stones_only,threads=4,max_tree_size=768,resign_threshold=0,maximize_score";
                    m_gtpEngine = new GoEngineWrapper(param);

                    m_gtpEngine.ResponsePushed += GtpEngine_ResponsePushed;
                }
            }
            catch (Exception exeption)
            {
                m_exeption = exeption;
            }
        }