<commit_before>#ifndef SNAKE_H
#define SNAKE_H


#define SNAKE_INIT_LEN 4

#define SEGMENT_WIDTH 5
#define SEGMENT_HEIGHT 5

#define GAME_SPEED 150

enum {
    NORTH,
    SOUTH,
    EAST,
    WEST,
};

struct Snake {
    int x;
    int y;
    int direction;
    int prev_direction;
    struct Snake *next_segment;
};

struct Head {
    int ate;
    int speed;
    int max_x;
    int max_y;
    int food_x;
    int food_y;
    int length;
    int direction;
    struct Snake *body;
};

// Initialize the head of the snake object.
struct Head *init_snake_head(int max_x, int max_y);

// Initialize the body of the snake object.
struct Snake *init_snake_body(int max_x, int max_y);

// Main game loop.
void mainloop(struct Head *head);

// Draws the snake body to window.
int draw_snake(struct Head *head);

// Randomly place a piece of snake food.
void place_snake_food(struct Head *head);

// Check if current coordinate is a valid position (i.e. no intersection).
int is_valid_position(struct Snake *segment, int x, int y);

// Check if any snake segments intersects with each other.
int check_segment_intersections(struct Head *head, struct Snake *segment);

// Calls for an update of all snake segments and checks if any food has been
// eaten.
void move_snake(struct Head *head);

// Change snake segment coordinates relative to their predecessors previous 
// direction.
void update_segment_direction(struct Head *head);

// Update snake segments, incrementing along their current direction.
void update_segment_coordinates(struct Snake *segment);

// Creates new Snake structure to add to snake.
struct Snake *create_segment(int direction, int x, int y);

// Creates a new segment after snake eats some food.
void add_segment(struct Head *head);

// Frees memory of the snake parts.
void free_snake(struct Head *snake_head);

// Frees memory of the snakes body.
void free_snake_body(struct Snake *body);

#define KEY_Q 113<commit_msg>print_score declaration<commit_after>#ifndef SNAKE_H
#define SNAKE_H


#define SNAKE_INIT_LEN 4

#define SEGMENT_WIDTH 5
#define SEGMENT_HEIGHT 5

#define GAME_SPEED 150

enum {
    NORTH,
    SOUTH,
    EAST,
    WEST,
};

struct Snake {
    int x;
    int y;
    int direction;
    int prev_direction;
    struct Snake *next_segment;
};

struct Head {
    int ate;
    int speed;
    int max_x;
    int max_y;
    int food_x;
    int food_y;
    int length;
    int direction;
    struct Snake *body;
};

// Initialize the head of the snake object.
struct Head *init_snake_head(int max_x, int max_y);

// Initialize the body of the snake object.
struct Snake *init_snake_body(int max_x, int max_y);

// Main game loop.
void mainloop(struct Head *head);

// Draws the snake body to window.
int draw_snake(struct Head *head);

// Randomly place a piece of snake food.
void place_snake_food(struct Head *head);

// Check if current coordinate is a valid position (i.e. no intersection).
int is_valid_position(struct Snake *segment, int x, int y);

// Check if any snake segments intersects with each other.
int check_segment_intersections(struct Head *head, struct Snake *segment);

// Calls for an update of all snake segments and checks if any food has been
// eaten.
void move_snake(struct Head *head);

// Change snake segment coordinates relative to their predecessors previous 
// direction.
void update_segment_direction(struct Head *head);

// Update snake segments, incrementing along their current direction.
void update_segment_coordinates(struct Snake *segment);

// Creates new Snake structure to add to snake.
struct Snake *create_segment(int direction, int x, int y);

// Creates a new segment after snake eats some food.
void add_segment(struct Head *head);

// Frees memory of the snake parts.
void free_snake(struct Head *snake_head);

// Frees memory of the snakes body.
void free_snake_body(struct Snake *body);

// Prints the end game score.
void print_score(struct Head *head);

#define KEY_Q 113
{'fraction_non_alphanumeric': 0.07962588473205258, 'fraction_numerical': 0.00455005055611729, 'mean_word_length': 3.778985507246377, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5224234', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1240, 'n_words': 493}