public void Start() { eGameResult gameResult; bool isPressedQ; bool isPlayerWantAnotherRound = true; m_IO = new IOhandler(); initGame(); m_Board = new Board(Move.s_Height, Move.s_Width); m_Engine = new Engine(m_Board, m_Player1, m_Player2); while (isPlayerWantAnotherRound) { m_IO.ShowBoard(m_Board); isPressedQ = m_Engine.Run(); if (isPressedQ) { m_IO.ShowGoodByeMessage(); } else { gameResult = GetGameResult(m_Player1, m_Player2); m_IO.ShowGameResultMessage(m_Player1, m_Player2, gameResult); isPlayerWantAnotherRound = m_IO.GetStartNewGameSelection(); if (isPlayerWantAnotherRound) { m_Board = new Board(Move.s_Height, Move.s_Width); m_Engine = new Engine(m_Board, m_Player1, m_Player2); } } } m_IO.ShowGoodByeMessage(); }
public Engine(Board io_Board, Player i_Player1, Player i_Player2) { m_IO = new IOhandler(); m_Board = io_Board; m_Player1 = i_Player1; m_Player2 = i_Player2; }