The distance robot probably had something along the lines of this:
Green Light
Motors On
Empty Container
Begin Container Loop to 10 (or random)
Wait for click
Add 1 to container
End Loop
Motors off
Multiply container * circumference of tire
RCX Display -> value of red container
Wait for 5 minutes
Red Light
The container loop will wait until the container value is 10. Every time you click it will add 1 to the container.
After it reaches 10 it will end the loop, turn off the motors. The value of the container (the number of revolutions your tires have gone) will be multiplied by the circumference to get the true distance.
You display this using the RCX communications command, and wait for a long period of time so that the value doesn't immediately flash off the screen.
Torque is rotational force, as opposed to linear force like pushing a car.
Mathematically, torque = force * distance.
Read more here, if you want:
http://en.wikipedia.org/wiki/Torque