My solution for the second assignment.
The assignment had three main parts:
- read in a grid size, path and obstacles from a file
- visualise the grid and path with ASCII
- repair a 'broken' path using a simple breadth-first search algorithm.
This required implementing a few data structures. I used a doubly-linked list for the path, which may not have been strictly necessary, but was a good exercise (especially as it ended up being on the exam :D).
I also implemented a growable ring buffer inspired by Rust's VecDeque, which was also not strictly necessary (I initially used a plain array), but was a bit of fun.
Due to the limitations of assignment submission, all the code had to be in a single file, ass2.c
.
See also: my course notes from the semester.