/****************************************************************/
/* hw7.h                                                        */
/* Justin Hartman                                               */
/* EECS 338 - Spring 2003                                       */
/* Assignment 7                                                 */
/****************************************************************/

/****************************************************************/
/* Written in Microsoft Visual C++ .NET                         */
/* Compiled and executed on CWRU's EECS department              */
/* lab's (Olin 404.5) SUN boxes using SSH and                   */
/* secure FTP                                                   */
/****************************************************************/

#define _REENTRANT

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
#include <ctype.h>
#include <pthread.h>
#include <signal.h>

#define ROW					20
#define COL					20
#define LOCATE(row, col)	printf("%c[%d;%dH", '\033', (row+1), (col+1))
#define CLS					LOCATE(0,0); printf("%c[2J", '\033')
#define TRAND(limit, n)		{struct timeval t; gettimeofday(&t, (void *)NULL); (n)=rand_r((unsigned *) &t.tv_usec) % (limit)+1;}
							 
#define CARROW				15
#define GUI_TIMEOUT_NS		500000000	/* 1/2 second in nanoseconds */

#define CAR_CHAR			'O'
#define OBSTACLE_CHAR		'#'
#define FREE_CHAR			' '
#define CRASH_CHAR			'X'

typedef enum worldstate {FREE, OBSTACLE, CRASH} WORLDSTATE;

typedef unsigned char BOOL;
#define TRUE	1
#define FALSE	0

void * gui(void *);
void * world(void *);
void * car(void *);