/* static string OldTestGame() * { * * * Console.Clear(); * WriteLine("Board height (Min. 8): "); * //WriteLine(">"); * var checkHeight = ReadLine(); * int height = 0; * if (!int.TryParse(checkHeight, out height)) * { * WriteLine("Not an integer"); * } * * WriteLine("Board width (Min. 8): "); * //WriteLine(">"); * var checkWidth = ReadLine(); * int width = 0; * if (!int.TryParse(checkWidth, out width)) * { * Console.WriteLine("Not an integer"); * } * * width = Convert.ToInt32(checkWidth); * height = Convert.ToInt32(checkHeight); * * var game2 = new BoardDimOld(height, width); * var doIt = false; * do * { * * * if (height < 8 || width < 8) * { * Console.WriteLine("Too small. Minimal board size is 8x8"); * } * * else if (height > 30 || width > 30) * { * Console.WriteLine("Too big. Maximum board size is 30x30"); * } * * * } while (!doIt); * * return "GAME OVER!!"; * * * * * } */ static string SaveGameState() { var game = new BoardDim(_settings); BoardDim.Mines.MinesSetter(_settings.BoardHeight, _settings.BoardWidth); return(""); }
/* * public static void PrintBoard(Engine.BoardDim game) * { * var g = new Engine.BoardDim.Mines(); * // g.GetMineCount(); * * * * * * var board = game.GetBoard(); * for (int yIndex = 0; yIndex < game.BoardHeight; yIndex++) * { * var line = ""; * for (int xIndex = 0; xIndex < game.BoardWidth; xIndex++) * { * * line = line + " " + GetSingleState(board[yIndex, xIndex]) + " "; * if (xIndex < game.BoardWidth - 1) * { * line = line + _verticalSeparator; * } * } * * Console.WriteLine(line); * * if (yIndex < game.BoardHeight - 1) * { * line = ""; * for (int xIndex = 0; xIndex < game.BoardWidth; xIndex++) * { * line = line + _horizontalSeparator+ _horizontalSeparator+ _horizontalSeparator; * if (xIndex < game.BoardWidth - 1) * { * line = line +_centerSeparator; * } * } * Console.WriteLine(line); * } * * * } * * } */ public static void PrintBoard(BoardDim game) { var board = game.GetBoard(); var line = " "; for (int i = 0; i < game.BoardWidth; i++) { line += (i + 1).ToString().PadRight(4, ' '); } Console.WriteLine(line); for (int yIndex = 0; yIndex < game.BoardHeight + 1; yIndex++) { line = " |"; for (int xIndex = 0; xIndex < game.BoardWidth; xIndex++) { line += _horizontalSeparator + _horizontalSeparator + _horizontalSeparator; if (xIndex < game.BoardWidth - 1) { line += _centerSeparator; } else { line += _verticalSeparator; } } Console.WriteLine(line); if (yIndex < game.BoardHeight) { line = ""; line = line + (yIndex + 1).ToString().PadLeft(3, ' ') + " |"; for (int xIndex = 0; xIndex < game.BoardWidth; xIndex++) { line = line + " " + GetSingleState(board[yIndex, xIndex]) + " "; if (xIndex < game.BoardWidth) { line += _verticalSeparator; } } line = line + " " + (yIndex + 1).ToString(); Console.WriteLine(line); } } line = " "; for (int i = 0; i < game.BoardWidth; i++) { line += (i + 1).ToString().PadRight(4, ' '); } Console.WriteLine(line); }
static string TestGame() { var game = new BoardDim(_settings); Console.WriteLine(); var done = false; do { Console.Clear(); GameUI.PrintBoard(game); BoardDim.Mines.MinesSetter(_settings.BoardHeight, _settings.BoardWidth); var userXint = 0; var userYint = 0; var userCanceled = false; (userYint, userCanceled) = GetUserIntInput("Enter Y coordinate", 1, 30, 0); if (!userCanceled) { (userXint, userCanceled) = GetUserIntInput("Enter X coordinate", 1, 30, 0); } if (userYint > _settings.BoardHeight || userXint > _settings.BoardWidth) { Console.WriteLine("Out of Range"); } if (userCanceled) { done = true; } else { game.Move(userYint - 1, userXint - 1); } var h = Engine.BoardDim.Board; _boardState = BoardDim.Board; GameConfigHandler.SaveCellState(_boardState); } while (!done); return("GAME OVER!!"); }