Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

7.11 Practice Problem Set 3 Q2 You are a programmer working for madlabs inc. Your team is currently planning an experiment to see if a

image text in transcribed
image text in transcribed
image text in transcribed
7.11 Practice Problem Set 3 Q2 You are a programmer working for madlabs inc. Your team is currently planning an experiment to see if a robot can survive while randomly moving about platforms suspended above lava (visual given here: link). Before conducting the experiment the team wants to test it with a simulator. It is your job to create that simulator The simulator will generate random numbers from 1 to 4 for each motion. Those numbers represent the movement of the robot in a cardinal direction (see link for details). For example, a movement value of 1 corresponds to moving one square in the north direction The robot will execute a number of motions equal to a user input value. After each movement, you must check to ensure the robot is still ona platform above the lava. If the robot ever moves off a platform then output "Robot fell after x successful movements and end the simulation. Replace x with however many successful movements have occurred (The movement that causes the robot to fall does not count as a successful movement). If the robot survives then output Robot survived" Example Given that the user inputs a value of 3, which then randomly generate the following 3 motions (the motions do not need to be generated all at once, you can generate a motion, check if it is valid, then generate another) then: movement one 1 movement two-1 movement three 4 The output should be "Robot fell after 1 successful mov IMPORTANT: An unspecified srand value will be used for testing This has already been implemented in your template You are free to hardcode a value for testing purposes, but be sure to change it back to how the had it setup template before submitting it for grading Psuedocode: (There are other ways of thinking about this problom, but perhaps this will be a helpful start) user inputs numMovements for each movement generated move robot check if robot is still on a platform If the robot ever moves oft the platform display appropriate output Else Display Robot survived 1 LAB 71 1 1 Practice Problem Set 3 02 ACTIVITY

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions