コード例 #1
0
ファイル: Reversi.cs プロジェクト: jakbrtz/MCTS
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            while (((gamenode.ActivePlayer == 0 && checkBox0.Checked) || (gamenode.ActivePlayer == 1 && checkBox1.Checked)) && gamenode.GameInProgress())
            {
                Draw("Thinking...");
                int move = gamenode.PickNextMove((int)numericUpDown1.Value);
                gamenode = gamenode.DoMove(move) as ReversiNode;
                Thread.Sleep(10);
            }
            string msg = "Your turn";

            if (!gamenode.GameInProgress())
            {
                switch (gamenode.Winner())
                {
                case 0:
                    msg = "White wins";
                    break;

                case 1:
                    msg = "Black wins";
                    break;

                default:
                    msg = "It's a tie";
                    break;
                }
            }
            Draw(msg);
        }