snake.h 495 B

1234567891011121314151617181920212223242526272829
  1. #ifndef SNAKE_H_
  2. #define SNAKE_H_
  3. #include <stddef.h>
  4. typedef struct {
  5. int x;
  6. int y;
  7. char vis_char;
  8. } SnakePart;
  9. typedef struct {
  10. SnakePart* parts;
  11. size_t max_length;
  12. size_t length;
  13. char dir;
  14. } Snake;
  15. SnakePart snake_get_part(const Snake* snake, const size_t index);
  16. Snake snake_alloc(
  17. const int board_square_count,
  18. const int init_x,
  19. const int init_y,
  20. const char init_dir
  21. );
  22. void snake_free(Snake* snake);
  23. void snake_move(Snake* snake);
  24. #endif // SNAKE_H_