Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include #include #define SIZE 15 #define EMPTY 0 #define STONE 1 // TODO: Add any extra #defines here. void printMap(int map[SIZE][SIZE], int playerX); //
#include#include #include #define SIZE 15 #define EMPTY 0 #define STONE 1 // TODO: Add any extra #defines here. void printMap(int map[SIZE][SIZE], int playerX); // TODO: Add any extra function prototypes here. int main (void) { // This line creates our 2D array called "map" and sets all // of the blocks in the map to EMPTY. int map[SIZE][SIZE] = {EMPTY}; // This line creates out playerX variable. The player starts in the // middle of the map, at position 7. int playerX = SIZE / 2; printf("How many lines of stone? "); // TODO: Scan in the number of lines of blocks. printf("Enter lines of stone: "); // TODO: Scan in the lines of blocks. printMap(map, playerX); // TODO: Scan in commands until EOF. // After each command is processed, you should call printMap. return 0; } // Print out the contents of the map array. Then print out the player line // which will depends on the playerX variable. void printMap(int map[SIZE][SIZE], int playerX) { // Print values from the map array. int i = 0; while (i Summary: Move Laser Command Command Name "Move Laser" Command Number 1 Inputs direction Examples Command Meaning 11 Move the laser downwards once. 1 - 1 Move the laser upwards once. 1 2 Invalid. Don't make any changes. Summary: Fire Laser Command Command Name "Fire Laser" Command Number 2 Inputs (none) Examples Command Meaning 2 Fire the laser rightwards. Summary: Move Laser Command Command Name "Move Laser" Command Number 1 Inputs direction Examples Command Meaning 11 Move the laser downwards once. 1 - 1 Move the laser upwards once. 1 2 Invalid. Don't make any changes. Summary: Fire Laser Command Command Name "Fire Laser" Command Number 2 Inputs (none) Examples Command Meaning 2 Fire the laser rightwards
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