private void cellButton_CheckingGameOver(object i_Sender, CellChosenEventArgs i_E) { Board.Cell.Parse(r_CellButtons[i_E.m_CellIndex].Name, out Board.Cell clickedCell); this.m_IsGameFinished = this.r_GameLogic.CheckEndGame(clickedCell, this.m_CurrentNumOfMoves, this.m_PlayerIndexTurn); if (this.m_IsGameFinished) { byte winnerPlayerIndex = GameLogic.GetOtherPlayerIndex(this.m_PlayerIndexTurn); this.showResults(winnerPlayerIndex); this.resetRound(); } }
internal void HandleComputerMove() { this.m_CurrentNumOfMoves++; Board.Cell computerMove = this.r_GameLogic.GetAIMove(this.m_PlayerIndexTurn); this.r_GameLogic.RegisterMove(computerMove, this.m_PlayerIndexTurn); this.MarkCellWithComputerSign(computerMove, this.m_PlayerIndexTurn); this.m_IsGameFinished = this.r_GameLogic.CheckEndGame(computerMove, this.m_CurrentNumOfMoves, this.m_PlayerIndexTurn); this.m_PlayerIndexTurn = GameLogic.GetOtherPlayerIndex(this.m_PlayerIndexTurn); if (this.m_IsGameFinished) { this.showResults(this.m_PlayerIndexTurn); this.resetRound(); } this.boldPlayer(k_Player1Index); }
internal void CellButton_Click(object sender, EventArgs e) { Board.Cell clickedCell; bool validCell = Board.Cell.Parse(((Button)sender).Name, out clickedCell); Button button = (Button)sender; if (button != null && button.Enabled && validCell) { m_CurrentNumOfMoves++; this.r_GameLogic.RegisterMove(clickedCell, m_PlayerIndexTurn); } if (this.r_GameLogic.GameType == eGameType.PersonVsComputer && !this.m_IsGameFinished) { this.m_PlayerIndexTurn = GameLogic.GetOtherPlayerIndex(this.m_PlayerIndexTurn); this.HandleComputerMove(); } else if (this.r_GameLogic.GameType == eGameType.PersonVsPerson) { this.m_PlayerIndexTurn = GameLogic.GetOtherPlayerIndex(this.m_PlayerIndexTurn); } }