Discover a wealth of knowledge at Westonci.ca, where experts provide answers to your most pressing questions. Get immediate and reliable answers to your questions from a community of experienced professionals on our platform. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields.
Sagot :
Answer:
The algorithm is as follows :
1. Record Current Position, Final Destination
2. While Current Position is not Final Destination, repeat the following:
2.1 If destination location is up then:
2.1.1 If an obstacle is directly above you then:
2.1.1.1 Look for alternate position (left, right, down)
2.1.1.2 If alternate position is found then
2.1.1.2.1 Move there
2.1.1.2.2 Record Current Position
2.1.1.3 If no alternate position is found then
2.1.1.3.1 Call for help
2.1.1.3.2 End
2.1.2 If no obstacle is directly above you then:
2.1.2.1 Move up
2.1.2.1 Record Current Position
2.2 If destination location is down then:
2.2.1 If an obstacle is directly below you then:
2.2.1.1 Look for alternate position (left, right, up)
2.2.1.2 If alternate position is found then
2.1.1.2.1 Move there
2.2.1.2.2 Record Current Position
2.2.1.3 If no alternate position is found then
2.2.1.3.1 Call for help
2.2.1.3.2 End
2.2.2 If no obstacle is directly below you then:
2.2.2.1 Move down
2.1.2.1 Record Current Position
2.3 If destination location is right then:
2.3.1 If an obstacle is directly by your right then:
2.3.1.1 Look for alternate position (down, up, left)
2.3.1.2 If alternate position is found then
2.3.1.2.1 Move there
2.3.1.2.2 Record Current Position
2.3.1.3 If no alternate position is found then
2.3.1.3.1 Call for help
2.3.1.3.2 End
2.3.2 If no obstacle is directly by your right then:
2.3.2.1 Move right
2.3.2.1 Record Current Position
2.4 If destination location is left then:
2.4.1 If an obstacle is directly by your left then:
2.4.1.1 Look for alternate position (down, up, right)
2.4.1.2 If alternate position is found then
2.4.1.2.1 Move there
2.4.1.2.2 Record Current Position
2.4.1.3 If no alternate position is found then
2.4.1.3.1 Call for help
2.4.1.3.2 End
2.4.2 If no obstacle is directly by your left then:
2.4.2.1 Move left
2.4.2.1 Record Current Position
Explanation:
The algorithm is straight forward.
All it does is to check for available position and move into the position if there is any available.
It keeps checking and moving until an obstacle prevents it from moving.
Thanks for using our service. We're always here to provide accurate and up-to-date answers to all your queries. We hope our answers were useful. Return anytime for more information and answers to any other questions you have. Keep exploring Westonci.ca for more insightful answers to your questions. We're here to help.