Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with a coding project. Please help me. mazelib.h file: mazelib.c file: #include #include #include #include #include mazelib.h static void set_offsets_for_dir(int*, int*, direction); static

Need help with a coding project. Please help me.

image text in transcribed

image text in transcribed

mazelib.h file:

image text in transcribed

mazelib.c file:

#include  #include  #include  #include  #include "mazelib.h" static void set_offsets_for_dir(int*, int*, direction); static void shuffle_dirs(direction*); static int xy_to_index(int, int); static void reset(void); static bool are_valid_maze_dimensions(int, int); static void set_offsets_for_dir(int*, int*, direction); static void maze_visit(int, int); static int width; static int height; static char *maze; static bool initializing = false; // maze_init allocates the memory for the maze array based on width and height bool maze_init(int w, int h) { if(!are_valid_maze_dimensions(w, h)) { return false; } width = w; height = h; srand(time(NULL)); maze = malloc(sizeof(*maze) * width * height); reset(); initializing = true; maze_visit(1, 1); maze_set_char(1, 1, 'S'); maze_set_char(width-2, height-2, 'E'); initializing = false; return true; } int maze_get_width(void) { return width; } int maze_get_height(void) { return height; } // returns "true" if x and y are both in-bounds defined by: // 0  8 && h > 8 && w  

mazerunner.c file:

image text in transcribed

Project 3 Maze Runner Due: 10th October 2017 Overview In this project we will revisit the logic of maze solving from earlier in the course, this time providing an act ual C implementation to solve the problem. In the course of this project, you will get more practice with all of the fundamental programmatic structures of C as well as experience using external library code. Finally you will need to create your first real . ' file so that your code can be interfaced with externally Submission Instructions Submit only the .c and .h files that you created along wit h your Makefile, but do not zip them! Additionally, be sure your makefile produces an executable called "maze runner" so that my test script can run it Technical Description and Instructions In this project, you will not write a full program. I have already written most of a program to solve randomly generated mazes. The parts that I have written generate the maze and provide functions through which the maze can be interacted with. Additionally, the parts that I have written rely on calling some functions that will solve the maze. Implementing those functions is your job! Your Two Files You must create two files for this project: "runner.c" and 'runner.h". Runner ".h" should expose two functions to the rest of the program called runner solve() and runner_init(). The first function will utilize the maze library functions I've provided to solve a maze1. The second function simply performs any setup necessary for the runner_solve() function to run. These two functions should be implemented in the "runner.c" file You may create as man helper functions as necessary to support your runner_solve() function2. Likewise, you may use any reasonable algorithm to actually solve the maze. Your runner must leave behind a trail of breadcrumbs' as it moves through the maze (see ?? for details) Program Output Program output is actually handled for you on this one! The maze runner.c file I've provided for you will cal print_maze ) for you to show both the unsolved maze and the maze after your runner has finished However, you must accurately show the path that was taken by your algorit hm to solve the maze. This is done by using the maze_set_char) function as your 'runner moves through the maze. When the runner crosses an empty square, it should leave a '.' behind. When t crosses a '.', it should leave an 'o behind. 1Descriptions of these maze library functions are in the comments of the mazelib.h file provided. 2My implementation has around five

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions