// set the boolean field of the current cell to be true internal void ExposeCell(int i_RowIndex, int i_ColIndex) { m_Board.SetBoolExpose(i_RowIndex, i_ColIndex, v_Expose); if (m_IsComputerPlaying) { char value = m_Board.GetCellValue(i_RowIndex, i_ColIndex); addElementToDict(i_RowIndex, i_ColIndex, value, v_UnExpose); removeElementFromDict(i_RowIndex, i_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); }