wm: gsnake

ref: b6339245db77c96386e708412d32ee961b9b7460
dir: /config.h/

View raw version
#include <unistd.h>
#include <ncurses.h>
#include <time.h>
#include <stdbool.h>
#include <stdlib.h>
typedef struct point { int x , y ;}point;
typedef enum dir{left,right,up,down}dir;

#define TIMEOUT 3 
#define MAX_SNAKE 30000
#define START_DIR right 
#define START_SIZE 5


int FG = COLOR_YELLOW;
int BG = COLOR_BLACK;
int color_slow = COLOR_CYAN;
int color_speed = COLOR_RED;

bool game_over = false;

const static bool teleport = true;
const bool auto_color_change = true;

const char snake_c[]=" ";
const char food_c[]="G";
const char head_char[]="N";;
const char speed_head_char[]="X";
const char slow_head_char[]="S";

bool speed = false ; 
bool slow = false ; 

point snake[MAX_SNAKE];
point food;
dir current_dir = START_DIR;

int max_x , max_y , snake_len = START_SIZE , score ;
int next_x , next_y;
int delay = 40000;

void draw_obj(point , const char[]);
void create_food();	
void init_screen();
void init_game();
void shift_snake();
void draw_all();
bool loop();
void pause_game();