Question: Stage 1 . 3 - Add Branch At this point, it's obvious that Australian weather is a coinflip, coincidentally it was windy earlier and as

Stage 1.3- Add Branch
At this point, it's obvious that Australian weather is a coinflip, coincidentally it was windy earlier
and as a result, Physics lawn has been littered with various foliage. After spawning the player,
the program should prompt for how many tiles of foliage will be added onto the map.
How many tiles of foliage: [count]
The first type of foliage you will be adding to the map are branches. Branches are 11 tiles,
and are passed in via the following input. The row / col values are the position of the
branch on the map. A successful addition will print Branch added! .
How many tiles of foliage: [count]
b [row][col]
Branch added!
b [row][col]
Branch added!
b [row][col]
Branch added!
After all foliage has been added you will need to then use the provided print_map() function
to print the map with the foliage.
HINT:
You will need to modify the 2D array, map , to add in the foliage. For branches, you
will need to change the tile type from EMPTY to .
NOTE:
Now would be a good time to make use of functions. You can move adding foliage
onto the map into its own function.
It is highly recommended that you approach tackling this substage and subsequent
stages onwards with the use of functions.
This will ensure that complex problems are easier to code up (logic) and can reduce
overdeep nesting (style).
Here is a diagram of a branch being added at (3,4). Branches are represented on the map as _/-. Error Handling
Like with Stage 1.2, foliage must be added within a predetermined boundary which are all the non-edge tiles of the map. If the position of the foliage lies outside, then that addition will be skipped (not added) and the program should print out Invalid foliage position!.
The foliage spawn boundary are the non-edge tiles of the map, i.e., tiles whose row/col are between 1 and MAX_ROW -2/MAX_COLUMN -2.
To ensure correct input handling, you might want to include a space before the %c specifier in the scanf function for reading characters to help clear any preceding whitespace characters or newline characters left in the input buffer from previous inputs.
 Stage 1.3- Add Branch At this point, it's obvious that Australian

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!