<commit_before>#include<stdio.h>  
#include<stdlib.h>  
#include<ncurses.h>  
#include<sys/time.h>  
#include<signal.h>  
#include"snake.h"  
  
struct position food;       /* food position */  
Snake_Node *head, *tail;    /* double linked list's head and tail */  
int x_dir = 1, y_dir = 0;   /* init dirction of the snake moving */  
int ttm = 5, ttg = 5;           /* two timers defined to control speed */  
  
void main(void)  
{  
    Init_Disp();            /* init and display the interface */  
    Food_Disp();            /* display food */  
    DLL_Snake_Create();     /* create double linked list and display snake*/  
    signal(SIGALRM, Snake_Move);  
    set_ticker(DFL_SPEED);  
    Key_Ctrl();             /* using keyboard to control snake */  
    Wrap_Up();              /* turn off the curses */  
}  
  
/* Function: Init_Disp() 
 * Usage: init and display the interface 
 * Return: none 
 */  
void Init_Disp()  
{  
    char wall = ' ';  
    int i, j;  
    initscr();  
    cbreak();               /* put termial to CBREAK mode */  
    noecho();  
    curs_set(0);            /* set cursor invisible */  
  
    /* display some message about title and wall */  
    attrset(A_NORMAL);      /* set NORMAL first */  
    attron(A_REVERSE);      /* turn on REVERSE to display the wall */  
    for(i = 0; i < LINES; i++)  
    {  
        mvaddch(i, LEFT_EDGE, wall);  
        mvaddch(i, RIGHT_EDGE, wall);  
    }  
    for(j = 0; j < COLS; j++)  
    {  
        mvaddch(0, j, '=');  
        mvaddch(TOP_ROW, j, wall);  
        mvaddch(BOT_ROW, j, wall);  
    }  
    attroff(A_REVERSE);     /* turn off REVERSE */  
    mvaddstr(1, 2, "Game: snake   good luck ;)");  
    mvaddstr(2, 2, "Author: <NAME>   ");  
    mvaddstr(3, 2, "Usage: Press 'f' to speed up, 's' to speed down,'q' to quit.");  
    mvaddstr(4, 2, "       Nagivation key controls snake moving.");  
    refresh();  
}  
  
/* Function: Food_Disp() 
 * Usage: display food position 
 * Return: none 
 */  
void Food_Disp()  
{  
    srand(time(0));  
    food.x_pos = rand() % (COLS - 2) + 1;  
    food.y_pos = rand() % (LINES - TOP_ROW - 2) + TOP_ROW + 1;  
    mvaddch(food.y_pos, food.x_pos, FOOD_SYMBOL);/* display the food */  
    refresh();  <commit_msg>Create main.c<commit_after>#include<stdio.h>  
#include<stdlib.h>  
#include<ncurses.h>  
#include<sys/time.h>  
#include<signal.h>  
#include"snake.h"  
  
struct position food;       /* food position */  
Snake_Node *head, *tail;    /* double linked list's head and tail */  
int x_dir = 1, y_dir = 0;   /* init dirction of the snake moving */  
int ttm = 5, ttg = 5;           /* two timers defined to control speed */  
  
void main(void)  
{  
    Init_Disp();            /* init and display the interface */  
    Food_Disp();            /* display food */  
    DLL_Snake_Create();     /* create double linked list and display snake*/  
    signal(SIGALRM, Snake_Move);  
    set_ticker(DFL_SPEED);  
    Key_Ctrl();             /* using keyboard to control snake */  
    Wrap_Up();              /* turn off the curses */  
}  
  
/* Function: Init_Disp() 
 * Usage: init and display the interface 
 * Return: none 
 */  
void Init_Disp()  
{  
    char wall = ' ';  
    int i, j;  
    initscr();  
    cbreak();               /* put termial to CBREAK mode */  
    noecho();  
    curs_set(0);            /* set cursor invisible */  
  
    /* display some message about title and wall */  
    attrset(A_NORMAL);      /* set NORMAL first */  
    attron(A_REVERSE);      /* turn on REVERSE to display the wall */  
    for(i = 0; i < LINES; i++)  
    {  
        mvaddch(i, LEFT_EDGE, wall);  
        mvaddch(i, RIGHT_EDGE, wall);  
    }  
    for(j = 0; j < COLS; j++)  
    {  
        mvaddch(0, j, '=');  
        mvaddch(TOP_ROW, j, wall);  
        mvaddch(BOT_ROW, j, wall);  
    }  
    attroff(A_REVERSE);     /* turn off REVERSE */  
    mvaddstr(1, 2, "snake");  
    mvaddstr(2, 2, "good luck ;)");  
    mvaddstr(3, 2, "Press 'f' to speed up, 's' to speed down,'q' to quit.");  
    mvaddstr(4, 2, "       Nagivation key controls snake moving.");  
    refresh();  
}  
  
/* Function: Food_Disp() 
 * Usage: display food position 
 * Return: none 
 */  
void Food_Disp()  
{  
    srand(time(0));  
    food.x_pos = rand() % (COLS - 2) + 1;  
    food.y_pos = rand() % (LINES - TOP_ROW - 2) + TOP_ROW + 1;  
    mvaddch(food.y_pos, food.x_pos, FOOD_SYMBOL);/* display the food */  
    refresh();  
{'fraction_non_alphanumeric': 0.1421251949209178, 'fraction_numerical': 0.00935620405435509, 'mean_word_length': 1.9193758127438232, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 14, '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': '2162242', 'n_tokens_mistral': 1690, 'n_tokens_neox': 1609, 'n_words': 423}