void DisplayBoard(char* board[ROWS][COLS]) { void majorRow(char* board[ROWS][COLS], int row) { for (int col = 1; col <= COLS; col++) { printf("%c ", *board[row-1][col-1]); } printf("\n"); } for (int row = 1; row <= ROWS; row++) { majorRow( board, row ); } }
// ------------------------------------------------------------------ // Coordinates: // row and column are square coordinates. // sr and sc are display coordinates void Viewer::drawGrid() { GridChar gc; GridChar::LineType rowType; GridChar::LineType colType; for (int sr = 0; sr < height; ++sr) { // Classify row type if (topEdge(sr)) rowType = GridChar::edge1; else if (botEdge(sr)) rowType = GridChar::edge2; else if (majorRow(sr)) rowType = GridChar::major; else if (minorRow(sr)) rowType = GridChar::minor; else rowType = GridChar::none; for (int sc = 0; sc < width; ++sc) { // Classify col type if (leftEdge(sc)) colType = GridChar::edge1; else if (rightEdge(sc)) colType = GridChar::edge2; else if (majorCol(sc)) colType = GridChar::major; else if (minorCol(sc)) colType = GridChar::minor; else colType = GridChar::none; cv->setPixel(sr, sc, gc.boxGlyph(rowType, colType)); } } }