diff options
author | scratko <m@scratko.xyz> | 2024-04-07 03:07:42 +0300 |
---|---|---|
committer | scratko <m@scratko.xyz> | 2024-04-07 03:07:42 +0300 |
commit | 2c2448cc94b8f17ac699814a75110411d57f3bea (patch) | |
tree | 4107fa66264cda94dd01c3bb00da29945c8d6131 /field.h | |
parent | bdee2852c13f6b02ec5207ded584839a3118233e (diff) | |
download | pacman-2c2448cc94b8f17ac699814a75110411d57f3bea.tar.gz pacman-2c2448cc94b8f17ac699814a75110411d57f3bea.tar.bz2 pacman-2c2448cc94b8f17ac699814a75110411d57f3bea.zip |
BFS, queue files
Fixed remaining direction check for pacman (old version was commented out).
Breadth First Search for red ghost.
Changed switch style.
Diffstat (limited to 'field.h')
-rw-r--r-- | field.h | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -1,6 +1,13 @@ #ifndef FIELD_H_SENTRY #define FIELD_H_SENTRY +enum { + field_width = 28, + field_height = 29, + door = '#', + block = '/' +}; + enum intersection_type { one_path = '1', two_paths = '2', @@ -8,13 +15,11 @@ enum intersection_type { direct_path }; -enum { - field_width = 29, - field_height = 29 +enum select_character { + ghost_char = '&', + pac_char = 'C' }; -enum select_character { ghost_char, pac_char }; - typedef char (*game_space)[field_width]; game_space get_new_field(); @@ -27,7 +32,7 @@ struct free_directions { void print_field(game_space field); -void display_character(int y, int x, int symbol); +void display_character(int y, int x, enum select_character symbol); struct ghost_type; void display_ghosts_on_field(struct ghost_type *red_ghost, @@ -35,12 +40,14 @@ void display_ghosts_on_field(struct ghost_type *red_ghost, struct ghost_type *blue_ghost, struct ghost_type *orange_ghost); -void clear_symbol(game_space field, int y, int x, +void eat_or_revert_symbol(game_space field, int y, int x, enum select_character character); -enum intersection_type get_intersection(const game_space field, +enum intersection_type get_intersection(const game_space field, struct ghost_type *ghost); struct free_directions find_free_directions(game_space field, int y, int x); +int is_obstacle(game_space field, int x, int y); + #endif |