Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 Problem Use the Force Luke! Luke Skywalker's on a missie He's the last X-Wing pilot in the desperate attack rn on the Death Star,
2 Problem Use the Force Luke! Luke Skywalker's on a missie He's the last X-Wing pilot in the desperate attack rn on the Death Star, d be has to guide paotoa torpedoes into the thermal exhaust port, which will destroy the Death Star. Pince o cake for a Jedi (eves cue harely into training) Plot twist: The empire has protected the thermal exhaust ports with room-like blocks of con- struction, with double skled mloed slields that bouace olf anything that touches them at 90 degree ange Luke is able to sesse the set-sp of the mirrors in this ToOm that's blocking him rom achieving his mission He decides to exploit the defense of the exhaust port to get the joh dose. He kows exactly whieh spot on the walls o this soom would lead iato tle eahaust poet. Dat, due to inexpericnce, he cant quite sense the spot oe the "other side that,whea hit, would send the proton torpedoes bouncing of the mirroeed shies isto the exhaust port lle decides to ask Obi-Wan far help. Your job, as Obi.Waa, ?s to barktrark from the exhaust port, backwards through the roomm, to the spot on the wall that Luke needs to hit, and tell him about it. Some things you need to note You will be given the dimensoas of the room and the "map of the room, including the 2. The cuhatat port will ahaays be 4m the west (kA) the bath(top) wall. 3 The peotos torpedo will he reflected off a mir AT MOST ONCE L The miots will always be orieated as a oe a &The walls of the room are represeuted by the character x'. The ehaast port is repeesented by The empty spaces aze seprsented by 1. Create a function called process that takes in two integer parameters repiresenting the lagth (uumber of rows) and the width (uumber of eolumns) of the room The function returs aothing. ponts) The main fanction shoald have at most 8 lises of code. (10 points) map of the room from the wser. (10 points) 2 In main, read in the nmber ofl sows and columas from the user and call the procesa fanction 3 In the process funetion, dynamically ereate a 2 dimmalceal array of chara. Read in the Search the armay to find out the locaticn (row and column as 2 variables) of the exhaust port The port will be in the Oth row or the Oth colum (10 points) & Trace the path the proton torpedo will take throagh the room backwards 2 points) 6 If we see a mimor,change the direction of the path accordingly. You can use an integer or a T. Stop when we reach the edge of the oom (when we see a wall character). Print the location S Delete the dynamie artay. ( polnts) char to keep track of the direction you're eurestly moving. (15 polats) as Crou, colus) whese we reach the wall (15 pots) Include comments wherever you think s appropeiate. (5 polnts) 10. You need to make sare you are never out of boands Since this is a dynamic array, it will eranh if we go out of the number of ows and columas we have Sample Run 1 Enter th sap: The entry point is (o.a) Sample Run 2 Enter the sap: The satry point s (4.10) Sample Run 3 Enter the unber of TOWS: Enter the sap: 3 Genmeric Guidelines 2. Please make sure you're only using the eoncepts already discussed in elass. Please do not use nact ues, classes,ec You ed to uwe dynamie memory allocation. Allocating a regular aray willesult in lomo Plhase male ure that you're conforming to specificatios (prograan ae, peint stateornts expected inputs and outputs ete.) No global variables (variabiles outside of mai G All ingst and out out wast be done with strea ing the libeary Sostrears 7 You may only e the soatreas and the catring Mradies (you do not nend any others o &. NO C style printing is permitted. (Ala, dont wse print). Use cout if you meed to print to When you write source code, it should be readable and these tasks the sereen 2 Problem Use the Force Luke! Luke Skywalker's on a missie He's the last X-Wing pilot in the desperate attack rn on the Death Star, d be has to guide paotoa torpedoes into the thermal exhaust port, which will destroy the Death Star. Pince o cake for a Jedi (eves cue harely into training) Plot twist: The empire has protected the thermal exhaust ports with room-like blocks of con- struction, with double skled mloed slields that bouace olf anything that touches them at 90 degree ange Luke is able to sesse the set-sp of the mirrors in this ToOm that's blocking him rom achieving his mission He decides to exploit the defense of the exhaust port to get the joh dose. He kows exactly whieh spot on the walls o this soom would lead iato tle eahaust poet. Dat, due to inexpericnce, he cant quite sense the spot oe the "other side that,whea hit, would send the proton torpedoes bouncing of the mirroeed shies isto the exhaust port lle decides to ask Obi-Wan far help. Your job, as Obi.Waa, ?s to barktrark from the exhaust port, backwards through the roomm, to the spot on the wall that Luke needs to hit, and tell him about it. Some things you need to note You will be given the dimensoas of the room and the "map of the room, including the 2. The cuhatat port will ahaays be 4m the west (kA) the bath(top) wall. 3 The peotos torpedo will he reflected off a mir AT MOST ONCE L The miots will always be orieated as a oe a &The walls of the room are represeuted by the character x'. The ehaast port is repeesented by The empty spaces aze seprsented by 1. Create a function called process that takes in two integer parameters repiresenting the lagth (uumber of rows) and the width (uumber of eolumns) of the room The function returs aothing. ponts) The main fanction shoald have at most 8 lises of code. (10 points) map of the room from the wser. (10 points) 2 In main, read in the nmber ofl sows and columas from the user and call the procesa fanction 3 In the process funetion, dynamically ereate a 2 dimmalceal array of chara. Read in the Search the armay to find out the locaticn (row and column as 2 variables) of the exhaust port The port will be in the Oth row or the Oth colum (10 points) & Trace the path the proton torpedo will take throagh the room backwards 2 points) 6 If we see a mimor,change the direction of the path accordingly. You can use an integer or a T. Stop when we reach the edge of the oom (when we see a wall character). Print the location S Delete the dynamie artay. ( polnts) char to keep track of the direction you're eurestly moving. (15 polats) as Crou, colus) whese we reach the wall (15 pots) Include comments wherever you think s appropeiate. (5 polnts) 10. You need to make sare you are never out of boands Since this is a dynamic array, it will eranh if we go out of the number of ows and columas we have Sample Run 1 Enter th sap: The entry point is (o.a) Sample Run 2 Enter the sap: The satry point s (4.10) Sample Run 3 Enter the unber of TOWS: Enter the sap: 3 Genmeric Guidelines 2. Please make sure you're only using the eoncepts already discussed in elass. Please do not use nact ues, classes,ec You ed to uwe dynamie memory allocation. Allocating a regular aray willesult in lomo Plhase male ure that you're conforming to specificatios (prograan ae, peint stateornts expected inputs and outputs ete.) No global variables (variabiles outside of mai G All ingst and out out wast be done with strea ing the libeary Sostrears 7 You may only e the soatreas and the catring Mradies (you do not nend any others o &. NO C style printing is permitted. (Ala, dont wse print). Use cout if you meed to print to When you write source code, it should be readable and these tasks the sereen
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started