コード例 #1
0
ファイル: Form1.cs プロジェクト: James-P-D/TicTacToeMinimax
        /// <summary>
        /// Set the text (Nought or Cross) for a button, and then
        /// disable it so user cannot click it again during this game.
        /// </summary>
        /// <param name="button">Button to set</param>
        /// <param name="cell">Nought, Cross or Empty</param>
        private void SetButtonCell(Button button, Board.Cell cell)
        {
            switch (cell)
            {
            case Board.Cell.Computer:
            {
                button.Text    = Board.CellToString(cell);
                button.Enabled = false;
                break;
            }

            case Board.Cell.Human:
            {
                button.Text    = Board.CellToString(cell);
                button.Enabled = false; break;
            }

            case Board.Cell.Empty:
            {
                button.Text    = Board.CellToString(cell);
                button.Enabled = true;
                break;
            }
            }
        }