Changed print function so it draws the correct border lengths on any grid size

This commit is contained in:
Tiehuis 2014-03-14 14:19:37 +13:00
parent 3c95ff2cb0
commit 9de291f188

View File

@ -182,8 +182,8 @@ void draw_grid()
printf("\n"); printf("\n");
// alter this SZ + 1 to match abitrary grid size // alter this SZ + 1 to match abitrary grid size
ITER(SZ + 1, printf("-----")); ITER(SZ, printf("------"));
printf("\n"); printf("-\n");
int i, j; int i, j;
for (i = 0; i < SZ; i++) { for (i = 0; i < SZ; i++) {
printf("|"); printf("|");
@ -195,8 +195,8 @@ void draw_grid()
} }
printf("\n"); printf("\n");
} }
ITER(SZ + 1, printf("-----")); ITER(SZ, printf("------"));
printf("\n\n"); printf("-\n\n");
} }
/* store the terminal settings and call this function on exit to restore */ /* store the terminal settings and call this function on exit to restore */
@ -248,7 +248,7 @@ int main(int argc, char **argv)
} }
/* random seed */ /* random seed */
srand(time(NULL)); srand((unsigned int)time(NULL));
ITER(2, rand_block()); ITER(2, rand_block());
draw_grid(); draw_grid();