public static void OutputBoards(BattleShips battleShips, Player player) { Console.WriteLine("Own Board:" + " ".Repeat(battleShips.Width) + "Firing board:"); for (int row = 1; row <= battleShips.Height; row++) { for (int ownColumn = 1; ownColumn <= battleShips.Width; ownColumn++) { Console.Write(battleShips.GetPlayerGameBoardPanel(player, row - 1, ownColumn - 1).Status + " "); } Console.Write(" "); for (int firingColumn = 1; firingColumn <= battleShips.Width; firingColumn++) { Console.Write(battleShips.GetPlayerFiringBoardPanel(player, row - 1, firingColumn - 1).Status + " "); } Console.WriteLine(Environment.NewLine); } Console.WriteLine(Environment.NewLine); }
private static void OutputBodyOfTheBoard(BattleShips game, Player player, int row) { var line = ""; for (int col = 0; col < game.Width; col++) { line = line + " " + game.GetPlayerFiringBoardPanel(player, col, row).Status + " "; if (col < game.Width - 1) { line += VerticalSeparator; } } line += $" {row + 1}"; if (row < 9) { line += " "; } else { line += " "; } if (game.GameType != GameType.HumanVsAi || game.Player1Turn) { for (int col = 0; col < game.Width; col++) { line = line + " " + game.GetPlayerGameBoardPanel(player, col, row).Status + " "; if (col < game.Width - 1) { line += VerticalSeparator; } } line += $" {row + 1}"; } //Console.WriteLine(line + $" {row + 1}"); Console.WriteLine(line); if (row < game.Height - 1) { line = ""; for (int col = 0; col < game.Width; col++) { line = line + HorizontalSeparator + HorizontalSeparator + HorizontalSeparator; if (col < game.Width - 1) { line = line + CenterSeparator; } } line += " "; if (game.GameType != GameType.HumanVsAi || game.Player1Turn) { for (int col = 0; col < game.Width; col++) { line = line + HorizontalSeparator + HorizontalSeparator + HorizontalSeparator; if (col < game.Width - 1) { line += CenterSeparator; } } } Console.WriteLine(line); } }