SlideShare a Scribd company logo
In this project, you will write a C program that utilizes command line arguments, file reading, file
writing, and iterating through two dimensional arrays. Restrictions: You may only import stdio.h,
stdlib.h and string.h You may not use any global variables. Premise: Jerry the mouse has been
captured by the evil scientist named Dr. Mays who has put him into a labyrinth. Jerry does not
know which way to go within the labyrinth and is now hungry as he has stayed in place for some
time. He smells some food nearby in the maze but is wary of wandering about endlessly. Your
task is to help Jerry find the food within the maze so that he can satisfy his hunger. Overview: The
maze has a grid layout with m x n rows and columns with the boundaries of the maze being
indicated by the '|' character. Within the maze, there are one or more locations of food being
indicated by the 'C' character. Also, Jerrys location is indicated at a random location by the 'M'
character with the whitespace character ' ' indicating positions within the maze that Jerry can
traverse. Consider the maze below: y x 1 1 11 1 1 1 36 1 The bottom left boundary of the maze
represents (x, y) coordinate (1,1) and the top right boundary of the maze represents (x, y)
coordinate (36, 11) Jerrys location within the maze is indicated by 'M' and his (x, y) coordinate is
(19, 9) Multiple cheeses (foods) are placed within the maze as indicated by 'C'. The (x, y) cheese
coordinates are (3, 2), (10,4), and (28, 10) Instructions: Your source file will be named p2__.c Your
program will utilize command line arguments where two file names will be provided on the
command line as follows: ./p2__ input_file1.txt input_file2.txt Input files: The first input file will be
the maze that you will utilize in your program. This maze is used by both the iterative search and
the recursive search functions (see functions section for more information) The second input file
will contain multiple lines that contain one of the four cardinal directions (N, E, S, W) that indicate
directions that Jerry will take within the maze during his iterative search but not during his
recursive search. Assumptions: There will be at least one cheese within the maze The input files
will contain a single dot (.) and its extension afterwards (txt, in, etc.) The length of a column for any
particular maze will not exceed 50 characters Each maze will contain a random location in which
Jerry is located Boundaries of the maze are indicated by '|' Coordinates which can be traversed
are indicated by ' ' (white space) Mazes will contain at least a single path to a cheese (both
iteratively and recursively) Cardinal directions in the second input file will be each on their own line
and will be a single valid capital letter character representing N, E, S, W Mazes are fully enclosed,
so Jerry cannot go out of bounds of any given maze Rows of a given maze will have the same
length Output: Your program will produce two separate output files where the first output files
name will start with iterative_ and then you will concatenate the file name the first input files name
but with the extension .out. Within the first output file, it will contain the final maze where the maze
indicates the paths taken by Jerry, Jerrys final location, and the (x, y) directions that were taken by
Jerry in an iterative manner. The second output files name will start with recursive_ and then you
will concatenate the file name the first input files name but with the extension .out. Within the
second output, it will contain the final maze where the maze indicates the paths taken by Jerry,
Jerrys final location and the (x, y) directions that were taken by Jerry that only led to a cheese in a
recursive manner. Specific Requirements: Your program must verify that there are two files input
via command line arguments. If this condition is not held, then your program must print an error
message and exit the program. Your program must verify that the two input files can be opened. If
this condition is not held, then your program must print an error message and exit the program.
Required functions (in addition to main): You are free to choose any additional parameters for both
of the functions below void iterative_search(char ** maze, ) The function utilizes the second input
file from the command line arguments as directions that Jerry takes as he iteratively traverses
through the maze. This function keeps track of every (x, y) coordinate that Jerry has visited on his
search for the cheese. Indicate coordinates that have been visited by the '.' character. Once Jerry
finds a cheese or if there are no more directions that Jerry can take, this function updates his final
location in the maze. int recursive_search(char ** maze, ) This function does not utilize the second
input file from the command line arguments. For this function, your output may differ based off how
you recurse through the maze this is fine as long as you find at least a cheese. This function
returns 1 if the recursive search led to a cheese otherwise it returns 0 to indicate that the path that
Jerry was on did not lead to a cheese. This function keeps track of the (x, y) coordinates that only
led Jerry to a cheese. This function Indicates coordinates that have been visited by the '.'
character. Once Jerry finds a cheese, this function updates his final location in the maze. Tips for
recursively searching: Consider the provided incomplete pseudocode as a starting point for your
function: FUNCTION RecursiveSearch (parameters: char pointer to pointer, ) IF current position
contains food return successful search ENDIF IF current position has been visited prior OR return
not a successful search ENDIF FOR ENDFOR ENDFUNCTION

More Related Content

Similar to In this project you will write a C program that utilizes co.pdf

Дмитрий Селиванов, OK.RU. Finding Similar Items in high-dimensional spaces: L...
Дмитрий Селиванов, OK.RU. Finding Similar Items in high-dimensional spaces: L...Дмитрий Селиванов, OK.RU. Finding Similar Items in high-dimensional spaces: L...
Дмитрий Селиванов, OK.RU. Finding Similar Items in high-dimensional spaces: L...
Mail.ru Group
 
ECS 60 Programming Assignment #1 (50 points) Winter 2016 .docx
ECS 60 Programming Assignment #1 (50 points) Winter 2016 .docxECS 60 Programming Assignment #1 (50 points) Winter 2016 .docx
ECS 60 Programming Assignment #1 (50 points) Winter 2016 .docx
jack60216
 
Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that Letter
Kevlin Henney
 
Ti1220 Lecture 7: Polymorphism
Ti1220 Lecture 7: PolymorphismTi1220 Lecture 7: Polymorphism
Ti1220 Lecture 7: PolymorphismEelco Visser
 
Functions2.pptx
Functions2.pptxFunctions2.pptx
Functions2.pptx
AkhilTyagi42
 
Lecture38
Lecture38Lecture38
Lecture38
David Evans
 
Programming in C sesion 2
Programming in C sesion 2Programming in C sesion 2
Programming in C sesion 2
Prerna Sharma
 
PYTHON
PYTHONPYTHON
PYTHON
JOHNYAMSON
 
Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...
Simplilearn
 
Fundamental classes in java
Fundamental classes in javaFundamental classes in java
Fundamental classes in java
Garuda Trainings
 
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docxISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
priestmanmable
 
Lecture20 vector
Lecture20 vectorLecture20 vector
Lecture20 vector
nurkhaledah
 
Programming Hp33s talk v3
Programming Hp33s talk v3Programming Hp33s talk v3
Programming Hp33s talk v3
Land Surveyors United Community
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming ii
Prashant Kalkar
 
Artificial Intelligence Lab File
Artificial Intelligence Lab FileArtificial Intelligence Lab File
Artificial Intelligence Lab File
Kandarp Tiwari
 
Introduction to Python , Overview
Introduction to Python , OverviewIntroduction to Python , Overview
Introduction to Python , Overview
NB Veeresh
 
C standard library functions
C standard library functionsC standard library functions
C standard library functions
Vaishnavee Sharma
 
Python Traning presentation
Python Traning presentationPython Traning presentation
Python Traning presentation
Nimrita Koul
 
Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that Letter
Kevlin Henney
 

Similar to In this project you will write a C program that utilizes co.pdf (20)

Дмитрий Селиванов, OK.RU. Finding Similar Items in high-dimensional spaces: L...
Дмитрий Селиванов, OK.RU. Finding Similar Items in high-dimensional spaces: L...Дмитрий Селиванов, OK.RU. Finding Similar Items in high-dimensional spaces: L...
Дмитрий Селиванов, OK.RU. Finding Similar Items in high-dimensional spaces: L...
 
ECS 60 Programming Assignment #1 (50 points) Winter 2016 .docx
ECS 60 Programming Assignment #1 (50 points) Winter 2016 .docxECS 60 Programming Assignment #1 (50 points) Winter 2016 .docx
ECS 60 Programming Assignment #1 (50 points) Winter 2016 .docx
 
Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that Letter
 
Ti1220 Lecture 7: Polymorphism
Ti1220 Lecture 7: PolymorphismTi1220 Lecture 7: Polymorphism
Ti1220 Lecture 7: Polymorphism
 
Functions2.pptx
Functions2.pptxFunctions2.pptx
Functions2.pptx
 
Lecture38
Lecture38Lecture38
Lecture38
 
Pig
PigPig
Pig
 
Programming in C sesion 2
Programming in C sesion 2Programming in C sesion 2
Programming in C sesion 2
 
PYTHON
PYTHONPYTHON
PYTHON
 
Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...
 
Fundamental classes in java
Fundamental classes in javaFundamental classes in java
Fundamental classes in java
 
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docxISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
 
Lecture20 vector
Lecture20 vectorLecture20 vector
Lecture20 vector
 
Programming Hp33s talk v3
Programming Hp33s talk v3Programming Hp33s talk v3
Programming Hp33s talk v3
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming ii
 
Artificial Intelligence Lab File
Artificial Intelligence Lab FileArtificial Intelligence Lab File
Artificial Intelligence Lab File
 
Introduction to Python , Overview
Introduction to Python , OverviewIntroduction to Python , Overview
Introduction to Python , Overview
 
C standard library functions
C standard library functionsC standard library functions
C standard library functions
 
Python Traning presentation
Python Traning presentationPython Traning presentation
Python Traning presentation
 
Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that Letter
 

More from abdulkadar1977

Which of the following is a control right 1 Shareholders .pdf
Which of the following is a control right 1 Shareholders .pdfWhich of the following is a control right 1 Shareholders .pdf
Which of the following is a control right 1 Shareholders .pdf
abdulkadar1977
 
What is politics What makes a decision political How do we.pdf
What is politics What makes a decision political How do we.pdfWhat is politics What makes a decision political How do we.pdf
What is politics What makes a decision political How do we.pdf
abdulkadar1977
 
Suppose X and Y are independent and identically distributed .pdf
Suppose X and Y are independent and identically distributed .pdfSuppose X and Y are independent and identically distributed .pdf
Suppose X and Y are independent and identically distributed .pdf
abdulkadar1977
 
Un comit tiene trece trece miembros Hay tres tres miembros.pdf
Un comit tiene trece trece miembros Hay tres tres miembros.pdfUn comit tiene trece trece miembros Hay tres tres miembros.pdf
Un comit tiene trece trece miembros Hay tres tres miembros.pdf
abdulkadar1977
 
The following is a set of data for a population with N10 1.pdf
The following is a set of data for a population with N10 1.pdfThe following is a set of data for a population with N10 1.pdf
The following is a set of data for a population with N10 1.pdf
abdulkadar1977
 
Step Minerals Removed Rock Name 4 example olivine forster.pdf
Step Minerals Removed Rock Name 4 example olivine forster.pdfStep Minerals Removed Rock Name 4 example olivine forster.pdf
Step Minerals Removed Rock Name 4 example olivine forster.pdf
abdulkadar1977
 
The Federal Deposit Insurance Corporation FDIC is a US c.pdf
The Federal Deposit Insurance Corporation FDIC is a US c.pdfThe Federal Deposit Insurance Corporation FDIC is a US c.pdf
The Federal Deposit Insurance Corporation FDIC is a US c.pdf
abdulkadar1977
 
Solve it using Ubuntu Homework 1 Modify the script for_loop.pdf
Solve it using Ubuntu Homework 1 Modify the script for_loop.pdfSolve it using Ubuntu Homework 1 Modify the script for_loop.pdf
Solve it using Ubuntu Homework 1 Modify the script for_loop.pdf
abdulkadar1977
 
Research Project Community Assessment Report Purpose For .pdf
Research Project  Community Assessment Report Purpose For .pdfResearch Project  Community Assessment Report Purpose For .pdf
Research Project Community Assessment Report Purpose For .pdf
abdulkadar1977
 
Select al the examples of Sexual Reproduction A Ecoli is a .pdf
Select al the examples of Sexual Reproduction A Ecoli is a .pdfSelect al the examples of Sexual Reproduction A Ecoli is a .pdf
Select al the examples of Sexual Reproduction A Ecoli is a .pdf
abdulkadar1977
 
Revise el siguiente estudio de caso y luego responda las pre.pdf
Revise el siguiente estudio de caso y luego responda las pre.pdfRevise el siguiente estudio de caso y luego responda las pre.pdf
Revise el siguiente estudio de caso y luego responda las pre.pdf
abdulkadar1977
 
Muscle contractions are driven by motor proteins What inter.pdf
Muscle contractions are driven by motor proteins What inter.pdfMuscle contractions are driven by motor proteins What inter.pdf
Muscle contractions are driven by motor proteins What inter.pdf
abdulkadar1977
 
please write all your steps on the paper 1 Economists are .pdf
please write all your steps on the paper 1 Economists are .pdfplease write all your steps on the paper 1 Economists are .pdf
please write all your steps on the paper 1 Economists are .pdf
abdulkadar1977
 
Londra Belediye Bakan Tate Modernin kamu finansmann artrma.pdf
Londra Belediye Bakan Tate Modernin kamu finansmann artrma.pdfLondra Belediye Bakan Tate Modernin kamu finansmann artrma.pdf
Londra Belediye Bakan Tate Modernin kamu finansmann artrma.pdf
abdulkadar1977
 
Q8Rehan Shrcyas and Darsan each value police protection .pdf
Q8Rehan Shrcyas and Darsan each value police protection .pdfQ8Rehan Shrcyas and Darsan each value police protection .pdf
Q8Rehan Shrcyas and Darsan each value police protection .pdf
abdulkadar1977
 
Describe the correct use of equipment to accurately measure.pdf
Describe the correct use of equipment to accurately measure.pdfDescribe the correct use of equipment to accurately measure.pdf
Describe the correct use of equipment to accurately measure.pdf
abdulkadar1977
 
7214 Exercise 6312 Continued Let X1Xn be iid having.pdf
7214 Exercise 6312 Continued Let X1Xn be iid having.pdf7214 Exercise 6312 Continued Let X1Xn be iid having.pdf
7214 Exercise 6312 Continued Let X1Xn be iid having.pdf
abdulkadar1977
 
2 Interview an older adult near retirement age to see how t.pdf
2 Interview an older adult near retirement age to see how t.pdf2 Interview an older adult near retirement age to see how t.pdf
2 Interview an older adult near retirement age to see how t.pdf
abdulkadar1977
 
1 Private label merchandise should be displayed to the left.pdf
1 Private label merchandise should be displayed to the left.pdf1 Private label merchandise should be displayed to the left.pdf
1 Private label merchandise should be displayed to the left.pdf
abdulkadar1977
 
Aadaki paragraf pasif sesi her paragrafta aktif sese evire.pdf
Aadaki paragraf pasif sesi her paragrafta aktif sese evire.pdfAadaki paragraf pasif sesi her paragrafta aktif sese evire.pdf
Aadaki paragraf pasif sesi her paragrafta aktif sese evire.pdf
abdulkadar1977
 

More from abdulkadar1977 (20)

Which of the following is a control right 1 Shareholders .pdf
Which of the following is a control right 1 Shareholders .pdfWhich of the following is a control right 1 Shareholders .pdf
Which of the following is a control right 1 Shareholders .pdf
 
What is politics What makes a decision political How do we.pdf
What is politics What makes a decision political How do we.pdfWhat is politics What makes a decision political How do we.pdf
What is politics What makes a decision political How do we.pdf
 
Suppose X and Y are independent and identically distributed .pdf
Suppose X and Y are independent and identically distributed .pdfSuppose X and Y are independent and identically distributed .pdf
Suppose X and Y are independent and identically distributed .pdf
 
Un comit tiene trece trece miembros Hay tres tres miembros.pdf
Un comit tiene trece trece miembros Hay tres tres miembros.pdfUn comit tiene trece trece miembros Hay tres tres miembros.pdf
Un comit tiene trece trece miembros Hay tres tres miembros.pdf
 
The following is a set of data for a population with N10 1.pdf
The following is a set of data for a population with N10 1.pdfThe following is a set of data for a population with N10 1.pdf
The following is a set of data for a population with N10 1.pdf
 
Step Minerals Removed Rock Name 4 example olivine forster.pdf
Step Minerals Removed Rock Name 4 example olivine forster.pdfStep Minerals Removed Rock Name 4 example olivine forster.pdf
Step Minerals Removed Rock Name 4 example olivine forster.pdf
 
The Federal Deposit Insurance Corporation FDIC is a US c.pdf
The Federal Deposit Insurance Corporation FDIC is a US c.pdfThe Federal Deposit Insurance Corporation FDIC is a US c.pdf
The Federal Deposit Insurance Corporation FDIC is a US c.pdf
 
Solve it using Ubuntu Homework 1 Modify the script for_loop.pdf
Solve it using Ubuntu Homework 1 Modify the script for_loop.pdfSolve it using Ubuntu Homework 1 Modify the script for_loop.pdf
Solve it using Ubuntu Homework 1 Modify the script for_loop.pdf
 
Research Project Community Assessment Report Purpose For .pdf
Research Project  Community Assessment Report Purpose For .pdfResearch Project  Community Assessment Report Purpose For .pdf
Research Project Community Assessment Report Purpose For .pdf
 
Select al the examples of Sexual Reproduction A Ecoli is a .pdf
Select al the examples of Sexual Reproduction A Ecoli is a .pdfSelect al the examples of Sexual Reproduction A Ecoli is a .pdf
Select al the examples of Sexual Reproduction A Ecoli is a .pdf
 
Revise el siguiente estudio de caso y luego responda las pre.pdf
Revise el siguiente estudio de caso y luego responda las pre.pdfRevise el siguiente estudio de caso y luego responda las pre.pdf
Revise el siguiente estudio de caso y luego responda las pre.pdf
 
Muscle contractions are driven by motor proteins What inter.pdf
Muscle contractions are driven by motor proteins What inter.pdfMuscle contractions are driven by motor proteins What inter.pdf
Muscle contractions are driven by motor proteins What inter.pdf
 
please write all your steps on the paper 1 Economists are .pdf
please write all your steps on the paper 1 Economists are .pdfplease write all your steps on the paper 1 Economists are .pdf
please write all your steps on the paper 1 Economists are .pdf
 
Londra Belediye Bakan Tate Modernin kamu finansmann artrma.pdf
Londra Belediye Bakan Tate Modernin kamu finansmann artrma.pdfLondra Belediye Bakan Tate Modernin kamu finansmann artrma.pdf
Londra Belediye Bakan Tate Modernin kamu finansmann artrma.pdf
 
Q8Rehan Shrcyas and Darsan each value police protection .pdf
Q8Rehan Shrcyas and Darsan each value police protection .pdfQ8Rehan Shrcyas and Darsan each value police protection .pdf
Q8Rehan Shrcyas and Darsan each value police protection .pdf
 
Describe the correct use of equipment to accurately measure.pdf
Describe the correct use of equipment to accurately measure.pdfDescribe the correct use of equipment to accurately measure.pdf
Describe the correct use of equipment to accurately measure.pdf
 
7214 Exercise 6312 Continued Let X1Xn be iid having.pdf
7214 Exercise 6312 Continued Let X1Xn be iid having.pdf7214 Exercise 6312 Continued Let X1Xn be iid having.pdf
7214 Exercise 6312 Continued Let X1Xn be iid having.pdf
 
2 Interview an older adult near retirement age to see how t.pdf
2 Interview an older adult near retirement age to see how t.pdf2 Interview an older adult near retirement age to see how t.pdf
2 Interview an older adult near retirement age to see how t.pdf
 
1 Private label merchandise should be displayed to the left.pdf
1 Private label merchandise should be displayed to the left.pdf1 Private label merchandise should be displayed to the left.pdf
1 Private label merchandise should be displayed to the left.pdf
 
Aadaki paragraf pasif sesi her paragrafta aktif sese evire.pdf
Aadaki paragraf pasif sesi her paragrafta aktif sese evire.pdfAadaki paragraf pasif sesi her paragrafta aktif sese evire.pdf
Aadaki paragraf pasif sesi her paragrafta aktif sese evire.pdf
 

Recently uploaded

The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 

Recently uploaded (20)

The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 

In this project you will write a C program that utilizes co.pdf

  • 1. In this project, you will write a C program that utilizes command line arguments, file reading, file writing, and iterating through two dimensional arrays. Restrictions: You may only import stdio.h, stdlib.h and string.h You may not use any global variables. Premise: Jerry the mouse has been captured by the evil scientist named Dr. Mays who has put him into a labyrinth. Jerry does not know which way to go within the labyrinth and is now hungry as he has stayed in place for some time. He smells some food nearby in the maze but is wary of wandering about endlessly. Your task is to help Jerry find the food within the maze so that he can satisfy his hunger. Overview: The maze has a grid layout with m x n rows and columns with the boundaries of the maze being indicated by the '|' character. Within the maze, there are one or more locations of food being indicated by the 'C' character. Also, Jerrys location is indicated at a random location by the 'M' character with the whitespace character ' ' indicating positions within the maze that Jerry can traverse. Consider the maze below: y x 1 1 11 1 1 1 36 1 The bottom left boundary of the maze represents (x, y) coordinate (1,1) and the top right boundary of the maze represents (x, y) coordinate (36, 11) Jerrys location within the maze is indicated by 'M' and his (x, y) coordinate is (19, 9) Multiple cheeses (foods) are placed within the maze as indicated by 'C'. The (x, y) cheese coordinates are (3, 2), (10,4), and (28, 10) Instructions: Your source file will be named p2__.c Your program will utilize command line arguments where two file names will be provided on the command line as follows: ./p2__ input_file1.txt input_file2.txt Input files: The first input file will be the maze that you will utilize in your program. This maze is used by both the iterative search and the recursive search functions (see functions section for more information) The second input file will contain multiple lines that contain one of the four cardinal directions (N, E, S, W) that indicate directions that Jerry will take within the maze during his iterative search but not during his recursive search. Assumptions: There will be at least one cheese within the maze The input files will contain a single dot (.) and its extension afterwards (txt, in, etc.) The length of a column for any particular maze will not exceed 50 characters Each maze will contain a random location in which Jerry is located Boundaries of the maze are indicated by '|' Coordinates which can be traversed are indicated by ' ' (white space) Mazes will contain at least a single path to a cheese (both iteratively and recursively) Cardinal directions in the second input file will be each on their own line and will be a single valid capital letter character representing N, E, S, W Mazes are fully enclosed, so Jerry cannot go out of bounds of any given maze Rows of a given maze will have the same length Output: Your program will produce two separate output files where the first output files name will start with iterative_ and then you will concatenate the file name the first input files name but with the extension .out. Within the first output file, it will contain the final maze where the maze indicates the paths taken by Jerry, Jerrys final location, and the (x, y) directions that were taken by Jerry in an iterative manner. The second output files name will start with recursive_ and then you will concatenate the file name the first input files name but with the extension .out. Within the second output, it will contain the final maze where the maze indicates the paths taken by Jerry, Jerrys final location and the (x, y) directions that were taken by Jerry that only led to a cheese in a recursive manner. Specific Requirements: Your program must verify that there are two files input via command line arguments. If this condition is not held, then your program must print an error message and exit the program. Your program must verify that the two input files can be opened. If this condition is not held, then your program must print an error message and exit the program.
  • 2. Required functions (in addition to main): You are free to choose any additional parameters for both of the functions below void iterative_search(char ** maze, ) The function utilizes the second input file from the command line arguments as directions that Jerry takes as he iteratively traverses through the maze. This function keeps track of every (x, y) coordinate that Jerry has visited on his search for the cheese. Indicate coordinates that have been visited by the '.' character. Once Jerry finds a cheese or if there are no more directions that Jerry can take, this function updates his final location in the maze. int recursive_search(char ** maze, ) This function does not utilize the second input file from the command line arguments. For this function, your output may differ based off how you recurse through the maze this is fine as long as you find at least a cheese. This function returns 1 if the recursive search led to a cheese otherwise it returns 0 to indicate that the path that Jerry was on did not lead to a cheese. This function keeps track of the (x, y) coordinates that only led Jerry to a cheese. This function Indicates coordinates that have been visited by the '.' character. Once Jerry finds a cheese, this function updates his final location in the maze. Tips for recursively searching: Consider the provided incomplete pseudocode as a starting point for your function: FUNCTION RecursiveSearch (parameters: char pointer to pointer, ) IF current position contains food return successful search ENDIF IF current position has been visited prior OR return not a successful search ENDIF FOR ENDFOR ENDFUNCTION