예제 #1
0
        protected void UpdateButton(object sender, EventArgs e)
        {
            if (current_state == State.White)
            {
                var moves = Othello_Minimax.GetBestMove(new Othello_Board(board), State.White, 4);
                if (moves.Item3 == -1)
                {
                    this.current_state = StateHandler.GetOppositeState(current_state);
                    return;
                }

                else
                {
                    board.UpdateBoard(moves.Item3, State.White, true);
                }
                //BetterButton btn = (BetterButton)sender;

                //int row = btn.row;
                //int col = btn.column;
                //board.UpdateBoard(row * 8 + col, State.White, true);
            }
            else
            {
                var moves = Othello_Minimax.GetBestMove(new Othello_Board(board), State.Black, 2);
                if (moves.Item3 == -1)
                {
                    this.current_state = StateHandler.GetOppositeState(current_state);
                    return;
                }

                else
                {
                    board.UpdateBoard(moves.Item3, State.Black, true);
                }
            }
            this.current_state = StateHandler.GetOppositeState(current_state);
            UpdateViewableBoard();
        }