help with a programing problem
Here is the problem
Design a program that models the worm’s behavior in the following scenario:
A worm is moving toward an apple. Each time it moves, the worm cuts the distance
between itself and the apple 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.
Here is my working solution. This is not an exercise in writing a program in a specfic language, but an exercise in how to write a program.
input module
declare Wormlength, AppleDistance as real
write what is the length of the worm?
input WormLength
write What is the distance to the apple?
input AppleDistance
While AppleDistance > Wormlength
AppleDistance - Wormlength
This is where I start running into problems. I know I need some kind of loop function and I need away to keep track of the distance covered.
Any help or direction would be great.
Re: help with a programing problem
What are you trying to find out? The number of steps? :blink:
Re: help with a programing problem
no I need to designa program that models the worm’s behavior in the given scenario.
Re: help with a programing problem
input module
declare Penislength, VaginaDistance, ThrustCount as real
write what is the length of the penis?
input PenisLength
write What is the distance to the vagina?
input VaginaDistance
Set ThrustCount = 0
While VaginaDistance > PenisLength
Decrease VaginaDistance by PenisLength
Increase ThrustCount by 1
end while
Call Process EnterVagina
:blink:
Re: help with a programing problem
I contend that ThrustCount will = 0 until penis enters vagina, but I degress:P:w00t:. Thanks for the help
Re: help with a programing problem
Couldn't resist changing the variable names, sorry! :P
Re: help with a programing problem
Quote:
Originally Posted by
Barbarossa
Couldn't resist changing the variable names, sorry! :P
It was more interesting than apples anyway
Re: help with a programing problem
I have another question relating to the original question. Is the counter actually need for this to work? I think the computer should be able to remember the value of VaginaDistance without the counter I could be wrong. I know I can have loops with and without counters. It seems to me this would be a time were a counter isn't needed. thanks
Re: help with a programing problem
You don't need the counter to model the behaviour of the worm, no. I only put one in because you said you wanted a counter :mellow:
Re: help with a programing problem
sorry about that... It was a left over thought from tryi ng to solve the problem