diff --git a/.gitignore b/.gitignore index 86732f5..157050f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ !README.md !*.py !*.h +!*.mk diff --git a/Makefile b/Makefile index bf1e2c6..4db3ffc 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ CFLAGS=-Wall -g -EXERCISES = $(patsubst %.c,%,$(shell ls ex*.c)) +EXERCISES = $(patsubst %.c,%,$(shell ls ex*.c | grep -v ex19)) all: $(EXERCISES) + $(MAKE) -f ex19.mk clean: diff --git a/ex19.h b/ex19.h new file mode 100644 index 0000000..0131465 --- /dev/null +++ b/ex19.h @@ -0,0 +1,54 @@ +#ifndef _ex19_h +#define _ex19_h + +#include "object.h" + + +struct Monster { + Object proto; + int hit_points; +}; + + +typedef struct Monster Monster; + + +int Monster_attack(void *self, int damage); +int Monster_init(void *self); + + +struct Room { + Object proto; + + Monster *bad_guy; + + struct Room *north; + struct Room *south; + struct Room *east; + struct Room *west; +}; + + +typedef struct Room Room; + + +void *Room_move(void *self, Direction direction); +int Room_attack(void *self, int damage); +int Room_init(void *self); + + +struct Map { + Object proto; + Room *start; + Room *location; +}; + + +typedef struct Map Map; + + +void *Map_move(void *self, Direction direction); +int Map_attack(void *self, int damage); +int Map_init(void *self); + +#endif diff --git a/ex19.mk b/ex19.mk new file mode 100644 index 0000000..aea800f --- /dev/null +++ b/ex19.mk @@ -0,0 +1,8 @@ +CFLAGS=-Wall -g + +all: ex19 + +ex19: object.o + +clean: + rm -f ex19