From 2c2448cc94b8f17ac699814a75110411d57f3bea Mon Sep 17 00:00:00 2001 From: scratko Date: Sun, 7 Apr 2024 03:07:42 +0300 Subject: BFS, queue files Fixed remaining direction check for pacman (old version was commented out). Breadth First Search for red ghost. Changed switch style. --- queue.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 queue.h (limited to 'queue.h') diff --git a/queue.h b/queue.h new file mode 100644 index 0000000..413b76f --- /dev/null +++ b/queue.h @@ -0,0 +1,25 @@ +#ifndef QUEUE_H_SENTRY +#define QUEUE_H_SENTRY + +#include "ghosts.h" + +struct item { + struct coordinates point; + struct item *next; +}; + +struct queue { + struct item *first; + struct item *last; +}; + +void queue_init(struct queue *q); +void queue_push(struct queue *q, const struct coordinates *data); +struct coordinates queue_front(const struct queue *q); +int empty(const struct queue *q); +void pop(struct queue *q); +int equal_points(struct coordinates tmp_point, struct coordinates target_point); +int is_consist_point(const struct queue *q, struct coordinates target_point); +void queue_clear(struct queue *q); + +#endif -- cgit v1.2.3