reduced field margins, new info display

This commit is contained in:
Noah Swerhun 2021-09-18 20:48:54 -05:00
parent bfd45695f3
commit 951715c2c9
5 changed files with 6 additions and 2 deletions

BIN
nsnake

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -50,6 +50,6 @@ int field_xy_is_apple(Field *f, int x, int y, size_t *p) {
int field_relocate_apple(Field *f, size_t i) { int field_relocate_apple(Field *f, size_t i) {
if (i > f->num) if (i > f->num)
return 0; return 0;
apple_move(f->a[i], irandom(5, f->x_max - 5), irandom(5, f->y_max - 5)); apple_move(f->a[i], irandom(2, f->x_max - 2), irandom(2, f->y_max - 3));
return 1; return 1;
} }

View file

@ -99,7 +99,11 @@ int main(void) {
score += snake_eat(s, f); score += snake_eat(s, f);
box(stdscr, 0, 0); box(stdscr, 0, 0);
mvprintw(getmaxy(stdscr) - 2, 1, "score: %d", score); mvprintw(getmaxy(stdscr) - 2, 1,
"score: %d | <%c> up | <%c> down | <%c> right | <%c> left | <%c> quit",
score, up_key,
down_key, right_key,
left_key, quit_key);
snake_print(s); snake_print(s);
field_print(f); field_print(f);