private static bool PlayTurnByUser(GameLogic io_Game, UIOrginaizer io_UI, int i_MyTurn) { int UserInsertionColumnSelection = 0; bool isColumnFull; bool isQuitPressed = false; io_UI.ShowTurnToUser(i_MyTurn); UserInsertionColumnSelection = io_UI.TakeDecisionFromUser("Column", io_Game.GetColumn); isQuitPressed = UserInsertionColumnSelection == 0; if (isQuitPressed) { Ex02.ConsoleUtils.Screen.Clear(); return(isQuitPressed); } isColumnFull = io_Game.CheckIfColumnFull(UserInsertionColumnSelection); while (isColumnFull) { Console.Write("Column {0} is full. Please choose another Column: ", UserInsertionColumnSelection); UserInsertionColumnSelection = io_UI.TakeDecisionFromUser("Column", io_Game.GetColumn); isColumnFull = io_Game.CheckIfColumnFull(UserInsertionColumnSelection); } if (i_MyTurn == 1) { io_Game.GeneralCoinInsertion("X", UserInsertionColumnSelection); } else { io_Game.GeneralCoinInsertion("O", UserInsertionColumnSelection); } io_UI.DrawBoard(io_Game.GetRow, io_Game.GetColumn, io_Game.GetBoard); return(isQuitPressed); }
private static void PlayTurnByComputer(GameLogic io_Game, UIOrginaizer io_UI) { io_UI.ShowTurnToUser(0); io_Game.ComputerCoinInsertion(); Ex02.ConsoleUtils.Screen.Clear(); io_UI.DrawBoard(io_Game.GetRow, io_Game.GetColumn, io_Game.GetBoard); }
private static bool PlayTurnByUser(GameLogic io_Game, UIOrginaizer io_UI, int i_MyTurn) { int UserInsertionColumnSelection = 0; bool isColumnFull; bool isQuitPressed = false; io_UI.ShowTurnToUser(i_MyTurn); UserInsertionColumnSelection = io_UI.TakeDecisionFromUser("Column", io_Game.GetColumn); isQuitPressed = UserInsertionColumnSelection == 0; if (isQuitPressed) { Ex02.ConsoleUtils.Screen.Clear(); return isQuitPressed; } isColumnFull = io_Game.CheckIfColumnFull(UserInsertionColumnSelection); while (isColumnFull) { Console.Write("Column {0} is full. Please choose another Column: ", UserInsertionColumnSelection); UserInsertionColumnSelection = io_UI.TakeDecisionFromUser("Column", io_Game.GetColumn); isColumnFull = io_Game.CheckIfColumnFull(UserInsertionColumnSelection); } if (i_MyTurn == 1) { io_Game.GeneralCoinInsertion("X", UserInsertionColumnSelection); } else { io_Game.GeneralCoinInsertion("O", UserInsertionColumnSelection); } io_UI.DrawBoard(io_Game.GetRow, io_Game.GetColumn, io_Game.GetBoard); return isQuitPressed; }
private static void PlayTurnByComputer(GameLogic io_Game, UIOrginaizer io_UI) { io_UI.ShowTurnToUser(0); io_Game.ComputerCoinInsertion(); Ex02.ConsoleUtils.Screen.Clear(); io_UI.DrawBoard(io_Game.GetRow, io_Game.GetColumn, io_Game.GetBoard); }