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 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 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 rowcol
Branch added!
b rowcol
Branch added!
b rowcol
Branch added!
After all foliage has been added you will need to then use the provided printmap function
to print the map with the foliage.
HINT:
You will need to modify the D 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 Branches are represented on the map as Error Handling
Like with Stage foliage must be added within a predetermined boundary which are all the nonedge 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 nonedge tiles of the map, ie tiles whose rowcol are between and MAXROW MAXCOLUMN
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.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
