/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <keytrace@home.se> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. diox
* ----------------------------------------------------------------------------
*/
#include <stdio.h>
#include <curses.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#define INCREASE_SPEED 45
#define REDUCE_SPEED 43
#define ESCAPE 27
#define SPACE 32
struct coord {
int y;
int x;
} snake[100];
void usage(const char PROGNAME[]);
void game_over(WINDOW *play_area, unsigned int score);
void error(const char error_message[]);
int main(int argc, char *argv[])
{
unsigned int n=0,m=0;
const char PROGNAME[] = "Snigelfan v 0.1b diox 2004";
unsigned int cmd_opts=0;
char *headskin = "O";
unsigned int wrapping=0;
unsigned int current_y=0, current_x=0;
const unsigned int MAX_ROWS=22, MAX_COLS=80; /* Size of play area */
WINDOW *play_area, *help_screen;
register unsigned int y=2, x=2, rand_y=20, rand_x=20; /* Dunno if register make this more optimized */
unsigned int illegal_coordinate=0;
unsigned int current_direction=2;
unsigned int pause=0, score=0, speed=80000, tail_length=1;
srand(time(NULL));
/* Clear the snake struct to avoid corrupt data */
for(n=0; n<100; n++) {
snake[n].x = 0;
snake[n].y = 0;
}
/* Command line options and arguments */