Question: 4. Write a C program that simulates a robot trying to climb up a staircase with steps numbered 0, 1, 2, ..., 10. The
4. Write a C program that simulates a robot trying to climb up a staircase with steps numbered 0, 1, 2, ..., 10. The robot starts on step 1. In each round, the robot will either move up one step (probability 0.75), move down one step (probability 0.18), or fall off the staircase (probability 0.07). Output the robot's location after each move. If the robot reaches step 10, output "SUCCESS" and stop; similarly, if the robot reaches step 0 or falls off, output "FAILURE" and stop. At the start of the simulation, seed the random number generator with the current time. (2 marks)
Step by Step Solution
3.56 Rating (160 Votes )
There are 3 Steps involved in it
C program include include include Function to simulate a single move of the robot int moveRobot doub... View full answer
Get step-by-step solutions from verified subject matter experts
