logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Write a C program to solve a rat breadcrumb maze

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Write a C program to solve a rat breadcrumb maze / Here is an example of a solved maze: // // ########################### // #S....#.oo..#.oooOoooooo..# // #####.###.#.#####o#####.#.# // # #.#...#.....#.#.....#.# // # # #.#.#######.###.#####.# // # # #...# #.#...#.....# // # ####### # ###.#.###.##### // # # ...# ....E# // ########################### Algorithm logic: runner.c file: #include #include // Including a header file lets your file refer to the functions *declared* in // that header file. The functions are usually *defined* elsewhere though, in // this case, mazelib.c #include "mazelib.h" #define NORTH 0 #define EAST 1 #define SOUTH 2 #define WEST 3 void runner_solve(void) { // Use a few variables to keep track of the current row and column position // of the "runner". The runner should always start at the 'S' symbol in the // maze. Luckily, the 'S' symbol is always in the same place // You should also keep track of which way the runner is facing. You can use // the preprocessor defines at the top of this file to make your life easier // instead of just having to remember "0 is North, 1 is East, etc." // Basically, any time you use NORTH in your code, a zero will be substituted // in for it at compile time. // Ok, algorithm time: // //

1. As long as you are not standing on the 'E', do the following: //

2. Turn to your left //

3. Can you go that way? I.E., is there not a wall in front of you? //

4. If your path is blocked, turn to your right and go back to (3) //

5. If your path is open, throw down the appropriate breadcrumb (see note) //

6. Move forward and go back to (1) //

7. You are standing on the 'E', STOP, you're done! // NOTE: By "appropriate breadcrumb" I mean this: // If you are in an empty square, the breadcrumb should be '.' // If you are in a square with '.',

the breadcrumb should be 'o' // If you are in a square with 'o', the breadcrumb should be 'O' // If you are in a square with 'O', the breadcrumb should be '@' // // Here is an example of a solved maze: // // ########################### // #S....#.oo..#.oooOoooooo..# // #####.###.#.#####o#####.#.# // # #.#...#.....#.#.....#.# // # # #.#.#######.###.#####.# // # # #...# #.#...#.....# // # ####### # ###.#.###.##### // # # ...# ....E# // ########################### }

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

692 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

978 Answers

Hire Me
expert
Husnain SaeedComputer science

941 Answers

Hire Me
expert
Atharva PatilComputer science

685 Answers

Hire Me