Пример #1
0
        /// <summary>
        /// Reinitialize the board and the players
        /// </summary>
        public void InitGame()
        {
            //Set an empty board
            for (int i = 0; i < board.GetLength(0); i++)
            {
                for (int j = 0; j < board.GetLength(1); j++)
                {
                    board[i, j] = -1;
                }
            }

            //Add starting disc
            board[3, 3] = 0;
            board[4, 3] = 1;
            board[3, 4] = 1;
            board[4, 4] = 0;

            //Initatial state
            isWhite  = false;
            isPaused = false;

            //Reset the two players
            playerWhite.Reset();
            playerBlack.Reset();
            playerBlack.StartTimer();
        }
Пример #2
0
        /// <summary>
        /// Switch between black/white turn and start/stop the timers
        /// </summary>
        public void SwitchTurn()
        {
            if (isWhite)
            {
                playerWhite.StopTimer();
                playerBlack.StartTimer();
            }
            else
            {
                playerBlack.StopTimer();
                playerWhite.StartTimer();
            }

            isWhite = !isWhite;
        }