private static bool isBoardDimensionsValid(string i_Height, string i_Width) { bool isDimensionsValid = false, isErrorMessagePrinted = false; int parsedStringHeightToInt, parsedStringWidthToInt; if (i_Height != string.Empty && i_Width != string.Empty) { if (int.TryParse(i_Height, out parsedStringHeightToInt) && int.TryParse(i_Width, out parsedStringWidthToInt)) { if (GameLogicComponent.CheckValidDimensions(parsedStringHeightToInt, parsedStringWidthToInt)) { if (GameLogicComponent.CheckEvenNumberOfCells(parsedStringHeightToInt, parsedStringWidthToInt)) { isDimensionsValid = true; } else { Console.WriteLine(string.Format("The board must have an even number of cells{0}", Environment.NewLine)); isErrorMessagePrinted = true; } } } } if (!isDimensionsValid && !isErrorMessagePrinted) { Console.WriteLine(string.Format("The inputs must be between the numeric values {0}-{1}{2}", GameLogicComponent.k_MinimalSize, GameLogicComponent.k_MaximalSize, Environment.NewLine)); } return(isDimensionsValid); }
private void printSeparatorLine(GameLogicComponent i_GameBoardToPrint) { Console.WriteLine(); Console.Write(" =="); for (int i = 1; i < i_GameBoardToPrint.Width; i++) { Console.Write("===="); } Console.Write("==="); Console.WriteLine(); }
public void CreateLogicComponent(int i_Height, int i_Width, Player i_PlayerOne, Player i_PlayerTwo) { this.m_LogicComponent = new GameLogicComponent(i_Height, i_Width, i_PlayerOne, i_PlayerTwo); }