Asked by Leo
I have a problem just getting started on writing pseudocode or a program for the following problem: A worm is moving toward an apple. each time it moves, the worm cuts the distance between itself and th eapple by its own body length until the worm is close enough to enter the apple. The worm can enter the apple when it is within a body length of the apple
Answers
Answered by
bobpursley
distance remaining= constant1
subroutine: check
if distance remaining<= lengthworm
Then enter
otherwise constant1= 1/2 * constant1
return
subroutine: enter
eat apple
end
subroutine: check
if distance remaining<= lengthworm
Then enter
otherwise constant1= 1/2 * constant1
return
subroutine: enter
eat apple
end
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.