back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/ghosts.h
diff options
context:
space:
mode:
Diffstat (limited to 'ghosts.h')
-rw-r--r--ghosts.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/ghosts.h b/ghosts.h
new file mode 100644
index 0000000..405a5e2
--- /dev/null
+++ b/ghosts.h
@@ -0,0 +1,65 @@
+#ifndef GHOSTS_H_SENTRY
+#define GHOSTS_H_SENTRY
+
+#include "field.h"
+
+enum {
+ red_y = 14,
+ red_x = 15,
+ red_home_y = -1,
+ red_home_x = 25,
+ pink_y = red_y + 1,
+ pink_x = red_x - 2,
+ pink_home_y = red_home_y,
+ pink_home_x = 1,
+ blue_y = red_y,
+ blue_x = red_x-1,
+ blue_home_y = 29,
+ blue_home_x = 27,
+ orange_y = red_y + 1,
+ orange_x = red_x - 3,
+ orange_home_y = blue_home_y,
+ orange_home_x = 0,
+ field_size = 29
+};
+
+enum ghost_color { red, pink, blue, orange };
+enum behavior_mode { chase, scatter, frightened };
+enum movement_direction { left, right, up, down, none };
+
+struct coordinates {
+ int y;
+ int x;
+};
+
+struct ghost_type {
+ struct coordinates position;
+ struct coordinates home_position;
+ enum ghost_color color;
+ enum behavior_mode mode;
+ enum movement_direction direction;
+};
+
+void initialize_ghost(struct ghost_type *ghost, enum ghost_color color);
+
+void pull_out_ghosts(int *get_out_stage,
+ struct ghost_type *red_ghost,
+ struct ghost_type *pink_ghost,
+ struct ghost_type *blue_ghost,
+ struct ghost_type *orange_ghost);
+
+void make_ghost_moves(game_space field,
+ struct ghost_type *red_ghost,
+ struct ghost_type *pink_ghost,
+ struct ghost_type *blue_ghost,
+ struct ghost_type *orange_ghost);
+
+void redirect(game_space field, enum intersection_type paths,
+ struct ghost_type *ghost,
+ void (*pathfinder)(game_space field, enum intersection_type paths,
+ struct ghost_type *ghost));
+
+void breadth_first_search(game_space field, enum intersection_type paths,
+ struct ghost_type *ghost);
+
+#endif