private void updateAmountOfPlayerThatDontPlay() { if (CounterAmountOfPlayerWithNoTurn == amoutOfPlayerWithNoTurn.ZeroPlayer) { CounterAmountOfPlayerWithNoTurn = amoutOfPlayerWithNoTurn.OnePlyer; } else { CounterAmountOfPlayerWithNoTurn = amoutOfPlayerWithNoTurn.TwoPlayer; } }
private void tryDoComputerTurn() { List <Utilities.ValidStep> validSteps; if (isTurnPossible(out validSteps, m_playerTwo)) { m_board.ReduceBlankCells(); CounterAmountOfPlayerWithNoTurn = amoutOfPlayerWithNoTurn.ZeroPlayer; int amountOfValidSteps = validSteps.Count; Random randomPlay = new Random(); int randomStepIndex = randomPlay.Next(0, amountOfValidSteps); m_board.updateBoard(validSteps[randomStepIndex], m_playerTwo.getShape().ToString()); } else { updateAmountOfPlayerThatDontPlay(); } }
private bool tryDoHumanTurn(Utilities.Point i_pointToCheck, Player i_PlayerToPlay) { List <Utilities.ValidStep> validSteps; if ((isTurnPossible(out validSteps, i_PlayerToPlay))) { m_board.ReduceBlankCells(); CounterAmountOfPlayerWithNoTurn = amoutOfPlayerWithNoTurn.ZeroPlayer; if ((isStepIsValid(validSteps, i_pointToCheck))) { m_board.updateBoard(validSteps[0], i_PlayerToPlay.getShape().ToString()); return(true); } } else { updateAmountOfPlayerThatDontPlay(); } return(false); }