I need help with this it is in C: Context: Stage 1 implements the…
QuestionAnswered step-by-stepI need help with this it is in C: Context: Stage 1 implements the…I need help with this it is in C:Context:Stage 1 implements the ability to read in stones and place them onto the map, move the laser up and down (and print this on the screen), and fire the laser to destroy sliding STONE.Placing StonesThe program should first ask for the number of STONEs as an integer. You can assume this number is valid. Then, the program will scan the locations of the stones as a group of three integers in the following format:row column valueThe row and column represent the location where a stone should be placed on the map. For stage 1 and 2, the third integer will always be 1 representing a STONE, however in other stages there will be other possibilities such as exploding TNT and night blocks. This number is the value which should be placed in the array itself. For example:Command: 0 0 1Meaning: Place a stone at [0][0].Command: 6 7 1Meaning: Place a stone at [6][7].$ ./slide How many blocks? 2 Enter blocks: 0 0 1 6 7 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0After scanning in the inputs relating to placing stones on the map, the program should then call print_map to display the map on the screen. The line of code to needed for this is already in the starter code. After printing the map, the program should start to scan in commands until EOF. (Your program’s behaviour should match the behaviour of the reference solution; when Ctrl + D is pressed, your program should end.) After processing each command, your program should call print_map once again to show the changes made to the map. Details of each command that your program must implement are shown below.In the starter code, the program currently initialises every square in the map to EMPTY then prints the map as a grid of integers.Invalid Input and AssumptionsThe first number scanned in (i.e. the number of coordinate pairs specified) will always be valid.It is possible for the first two integers (row column) to result in location outside of the map. If this is the case, you should ignore this stone completely and not make any changes to the map.The third integer can be assumed to be valid. For this stage it will always be 1 (you don’t have to check this).Moving the LaserCommand Name: “Move Laser”Command Number: 1Inputs: directionExamplesCommand: 1 1Meaning: Move the laser upwards on the page (decrement the index) once.Command: 1 -1Meaning: Move the laser downwards on the page (increment the index) once.Command: 1 2Meaning: Invalid. Don’t make any changes.For the next part of stage 1, you will implement a command to move the laser up or down the screen.The first integer of any move laser command will always be a 1. The second integer represents the direction. 1 means to move the laser upwards and -1 means to move the laser downwards.Information about the laser’s current position is given to the print_map function, so it is recommended to update the laser_y variable in the main function when this command is received. This will have the effect of changing the position of the > symbol printed by print_map the next time it is called.Note that after each command has been scanned in and processed the map is printed once again.$ ./slide How many blocks? 1 Enter blocks: 4 5 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0Invalid Input and AssumptionsThe second integer of a move laser command may be something else other than -1 or 1. In this case, your program should print out the map unchanged.Your program may be given a sequence of move laser commands which would theoretically move the laser off the map. Ensure the laser is always next to a row of the map. If the laser is on an edge row (the top or bottom row) and a move laser command is received which would push it over the edge, your program should print out the map unchanged.Firing the LaserCommand Name: “Fire Laser”Command Number: 2Inputs: (none)ExamplesCommand: 2Meaning: Fire the laser rightwards.For the final part of stage 1, you will implement a command to fire the laser and destroy some blocks.This time the first integer of this command will always be a 2. There will not be any additional integers after this.This command means to fire the laser at the laser’s current position. The laser will destroy at most 4 stones. Destroying a stone can be done by changing the value in the array from STONE to EMPTY.A laser will only destroy directly to the right of it’s current position. It can destroy a maximum of four blocks. The blocks it destroys do not need to be next to eachother.Hint: Even though you are looping through a 2D array, only one while loop is required to execute this command as you are looping through a straight line in the array.$ ./slide How many blocks? 23 Enter blocks: 5 5 1 5 6 1 5 7 1 6 5 1 6 6 1 6 7 1 7 5 1 7 6 1 7 7 1 7 8 1 8 5 1 8 6 1 8 7 1 8 8 1 8 9 1 8 10 1 9 5 1 9 6 1 9 7 1 9 8 1 9 9 1 9 10 1 9 11 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 > 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0Invalid Input and AssumptionsSince there is only one number in this command, there are no invalid input possibilities.Note that there may be no stones in the laser’s current row, in which case no changes should be made.It is possible to score a passing mark in this assignment with the completion of stage 1 only. My code so far:#include


