head 1.4; access; symbols; locks poly:1.4; strict; comment @ * @; 1.4 date 2006.04.06.03.48.37; author poly; state Exp; branches; next 1.3; 1.3 date 2006.04.03.03.11.38; author poly; state Exp; branches; next 1.2; 1.2 date 2006.04.01.08.38.50; author poly; state Exp; branches; next 1.1; 1.1 date 2006.03.31.05.04.29; author poly; state Exp; branches; next ; desc @in @ 1.4 log @in @ text @/* * Printing.c * omino_fitting_2006 * * Created by david van brink on 3/30/06. * Copyright 2006 __MyCompanyName__. All rights reserved. * */ #include #include "Printing.h" #include #include long long getUSecTime() { UnsignedWide uw; Microseconds(&uw); long long uSec = ((long long)uw.hi << 32LL) + uw.lo; return uSec; } void printField(OFField *field) { int rows = field->cellCount / field->rowCells; int x,y; for(y = rows - 1; y >= 0; y--) { for(x = 0; x < field->rowCells; x++) { int k = field->cells[y * field->rowCells + x]; k = k == 0 ? ' ' : ((k - 32) & 0x3f) + 32; printf("%c",k); } printf("\n"); } } void printField3(OFField *field) { int rows = field->cellCount / field->rowCells; printf("-----------------------------------\n"); printf("%d x %d\n",field->width,field->height); int x,y; for(y = rows - 1; y >= 0; y--) { for(x = 0; x < field->rowCells; x++) { printf(" %02x",0x000000ff & field->cells[y * field->rowCells + x]); } printf("\n"); } } OFCell getCell(OFField *field,int x,int y) { if(x < 0 || x >= field->width || y < 0 || y >= field->height) return 0; return field->cells[field->cell00 + x + field->rowCells * y]; } void printField2(OFField *field) { int x,y; for(y = field->height; y >= -1; y--) { // first across -- vertical lines for(x = -1; x <= field->width; x++) { OFCell a = getCell(field,x,y); OFCell r = getCell(field,x + 1,y); printf(" %c",a == r ? ' ' : '|'); } printf("\n"); // second across -- horizontal lines & crossings for(x = -1; x <= field->width; x++) { OFCell a = getCell(field,x,y); OFCell r = getCell(field,x + 1,y); OFCell d = getCell(field,x,y - 1); OFCell dr = getCell(field,x + 1,y - 1); if(a == d) printf(" "); else printf("--"); int vertDiff = (a != r || d != dr); int horzDiff = (a != d || r != dr); if(vertDiff && horzDiff) printf("+"); else if(horzDiff) printf("-"); else if(vertDiff) printf("|"); else printf(" "); } printf("\n"); } } @ 1.3 log @in @ text @d48 18 @ 1.2 log @in @ text @d41 1 a41 1 k = ((k - 32) & 0x3f) + 32; d46 53 a98 1 }@ 1.1 log @Initial revision @ text @d12 17 d41 1 a41 1 k = (k & 0x3f) + 32; @