summaryrefslogtreecommitdiff
path: root/texad.h
blob: a0f1c3714d285eedb61555a3e37cdb7d5897e7a0 (plain) (blame)
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
#include <stdlib.h>

#define INPUT_LIMIT 256
#define PROMPT "> "

enum action {
    UNKNOWN,
    LOOK,
    GO_NORTH,
    GO_SOUTH,
    GO_EAST,
    GO_WEST,
    QUIT
};

enum direction {
    NORTH,
    SOUTH,
    EAST,
    WEST
};

struct room {
    char *title;
    char *description;
    struct door **doors;
};

struct door {
    enum direction direction;
    struct room *src;
    struct room *dst;
};

struct world {
    struct player *player;
};

struct player {
    char *name;
    struct room *room;
};

struct command {
    enum action action;
    char *string;
};

struct world *genesis(void);
void apocalypse(struct world *);
enum action parse(char *);
void move(struct player *, enum direction);
void look(struct room *);
int loop(struct world *);