Homework 4 Problem 3
You cannot submit for this problem because the homework's deadline is due.
Submission
Submit your program on Joint Online Judge (JOJ) and take a screenshot of your result and submit that photo on CANVAS Homework4Ex3Answer. For JOJ submission, name your program as ex3.c and upload the compressed file. Note that, JOJ will post system error. Just submit and don't worry about that.
Description
Generate an 10-by-10 character map, where each cell is initially filled with character ’.’. Now suppose a player is located at the top left-most corner of this map. Start from this position, and random walk the player. And mark the tranversing location with the alphabetic characters sequentially started with ’A’. When the predicted location of the next step is located outside the map, or has been occupied with the previous alphabetic characters, a new direction has to be selected again. The random walk stops when all four directions (left, right, up, down) has been tranversed, or the alphabetic character reaches ’Z’.
Requirement
Your program should at least have two functions:
void generate random walk(char walk[10][10])
, and void print map(char walk[10][10])
, where the first function takes in the array and initialize all its entries with character ’.’, and conduct random walk, the second function prints out the resulting map after the random walk.
Sample Output
A B . . . . . . . .
. C . . . . . . . .
. D E H I J . . . .
. . F G R K . . . .
. . . . Q L M . . .
. . . . P O N . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
Homework 4
- Status
- Finished
- Problems
- 5
- Open Since
- 2020-07-01 00:00
- DDL
- 2020-07-07 23:59
- Extension
- 48.0 hour(s)