Wormhole simulation
The applet below simulates a wormhole with a time difference between the two mouths. A ball bounces around, and will exit the right mouth before it enters the left mouth. It often collides with itself, and generally this collision is what causes it to enter the left mouth of the wormhole, thus setting up the possibility of the collision.
Further Information
The theory of wormholes on which this applet is based arose in the mid 1980's from the attempt to give theoretical justification for science-fictional methods for travelling large distances across the universe. It was realised that as well as being used for travel across space, such a system could also operate as a time machine. This led to considerations of the 'Grandfather paradox' - if you went back in time and killed your grandfather, then you would never be born and so you wouldn't be able to go back in time and kill your grandfather. Since wormholes are rooted in legitimate science, they allow the possibility of studying this paradox in more detail. This was done in the early 1990's, looking at the example of a billiard ball being aimed into one mouth of the wormhole so that it would come out and hit itself before it entered, thus stopping it from going in. It was realised that it was possible to find a consistent solution, in which the ball comes out on a slightly different trajectory from that expected. It still hits itself, but with a glancing blow, so that instead of being prevented from entering the wormhole, its trajectory is just slightly changed. It has been conjectured that such a consistent solution is possible for any situation which could be dreamt up, but unfortunately the calculations rapidly increase in difficulty, and the subject has not progressed much further.
Source Code