In this challenge, you will use a LOOP block to program your robot to move freel
ID: 2247747 • Letter: I
Question
In this challenge, you will use a LOOP block to program your robot to move freely inside a black boundary. The color sensor has to be used to tell the robot to back up, turn, and then start going straight again. At no time can the robot cross the black line. Make sure your solution contains a loop. Begin by analysing the problem. Talk about your solution. What needs to be done repeatedly in this program? How can the robot "notice" the black line? What does it need to do once black line is sensed by the color sensor? Write pseudocode for the robot staying within the black boundary. What adjustments did you have to make from your original pseudocode? Do not modify it, but tell me what you changed, if anything. How would you test your program? Does it matter what position you start the robot?Explanation / Answer
Hence, these are the psuedcode and testing program for the robots given.
Pseudocode for Robot Movements:
1. Initialize Robot's Position to initial.
2. Initialize the boundary to final.
3. Make movements for robots as up,down,right,left.
4. To identify the boundary we will add color to the boundary as black.
5. As, soon as the robot reaches to the black boundary, it will be forced to move the other side.
6. Iterate Step 4 & Step 5.
Testing Program
void robotMovement
{
if(robotMoves == Color.black || robotMoves == final)
go(nextAlternative);
else
deletePath(robotPosition , nextAlternative);
go(nextAlternative);
}
Rate an upvote.......Thankyou
Hope this helps.....
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.