// checks if the cell is not exposed internal bool IsValidCell(string i_StrToCheck) { int rowIndex = i_StrToCheck[1] - '1'; int colIndex = i_StrToCheck[0] - 'A'; return(!m_Board.GetBoolExpose(rowIndex, colIndex)); }
// given a board, prints the board in the required format as needed. internal static void printBoardToScreen(MemoryBoard i_Board) { StringBuilder boardToPrint = new StringBuilder(); int rowLength = i_Board.GetNumberOfRows(); int colLength = i_Board.GetNumberOfColumns(); // prints the first row for (int i = 0; i <= colLength; i++) { if (i == 0) { boardToPrint.Append(" "); } else { boardToPrint.Append((char)(k_FirstColumnIndex + i - 1)); boardToPrint.Append(" "); } } helperPrinter(colLength, ref boardToPrint); for (int i = 0; i < rowLength; i++) { boardToPrint.Append((char)(k_FirstRowIndex + i)); boardToPrint.Append(" | "); for (int j = 0; j < colLength; j++) { string strToAppend = i_Board.GetBoolExpose(i, j) ? i_Board.GetCellValue(i, j).ToString() : (" "); boardToPrint.Append(strToAppend); boardToPrint.Append(" | "); } helperPrinter(colLength, ref boardToPrint); } Console.Write(boardToPrint); }