Snake render grid lines without extra space after last '#'

This commit is contained in:
Bananymous 2023-09-05 14:33:49 +03:00
parent 0770ba0936
commit 0d725f68e3
1 changed files with 6 additions and 4 deletions

View File

@ -81,8 +81,9 @@ void setup_grid()
printf("\e[H\e[J");
// Render top line
for (int x = 0; x < g_grid_size.x + 2; x++)
printf("# ");
putchar('#');
for (int x = 1; x < g_grid_size.x + 2; x++)
printf(" #");
putchar('\n');
// Render side lines
@ -90,8 +91,9 @@ void setup_grid()
printf("#\e[%dC#\n", g_grid_size.x * 2 + 1);
// Render Bottom line
for (int x = 0; x < g_grid_size.x + 2; x++)
printf("# ");
putchar('#');
for (int x = 1; x < g_grid_size.x + 2; x++)
printf(" #");
putchar('\n');
// Render snake head