Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef __COMMON_H__
#define __COMMON_H__
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <unistd.h>
#define UP 0
#define DOWN 1
#define LEFT 2
#define RIGHT 3
#define TRAIL_UP 4
#define SERV_PORT 5555
#define XMAX 100
#define YMAX 50
#define TIE -2
#define TRAIL_INDEX_SHIFT 50
#define SA struct sockaddr
#define SAI struct sockaddr_in
#define TV struct timeval
#define WALL 111
#define max(a, b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
#define CHECK(x) \
do \
{ \
if (!(x)) \
{ \
fprintf(stderr, "%s:%d: ", __func__, __LINE__); \
perror(#x); \
exit(EXIT_FAILURE); \
} \
} while (0)
typedef struct display_info
{
char board[XMAX][YMAX];
int winner;
} display_info;
struct client_input {
int id;
char input;
};
struct client_init_infos {
int nb_players;
};
#endif