Exemplo n.º 1
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            PlayerConfigurationControl current = configuration.GetPlayer(player);

            //int bonusDepth = Math.Max(current.Depth - (board.Befores[Player.White] + board.Befores[Player.Black]), 0);

            //Result result = current.Algorithm.Run(current.Evaluator, board, player, current.Depth + bonusDepth);
            Result result = current.Algorithm.Run(current.Evaluator, board, player, current.Depth);

            Debug.WriteLine(String.Format("{0},{1},{2}", current.Algorithm, player, current.Algorithm.Hits));

            e.Result = result;
        }
Exemplo n.º 2
0
        private void UpdateControls()
        {
            boardControl.Update(board, player);
            moveListBox_SelectedIndexChanged(null, EventArgs.Empty);

            PlayerConfigurationControl current = configuration.GetPlayer(player);
            bool human = current.PlayerType == PlayerType.Human;

            boardControl.Enabled       = human;
            moveListBox.Enabled        = human;
            transistionListBox.Enabled = human;
            hintButton.Enabled         = human && moveListBox.Items.Count > 0;
            backButton.Enabled         = human && transistionListBox.Items.Count > 0;
        }
Exemplo n.º 3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            PlayerConfigurationControl current = configuration.GetPlayer(player);

            if (current.PlayerType == PlayerType.Computer && !backgroundWorker1.IsBusy)
            {
                backgroundWorker1.RunWorkerAsync();
            }

            if (current.Algorithm.Done <= current.Algorithm.Total)
            {
                progressBar1.Maximum = current.Algorithm.Total;
                progressBar1.Value   = current.Algorithm.Done;
            }
        }