HALF LIFE (16K ZX81)
by Tim Raymond Nugent, Aberdeen
from Your Computer, December 1981, Page 77

Half Life may be of interest to science teachers. It was developed using the
ZX-81 with 16K RAM. The program simulates the radidactive decay of a sample
of 196 radioactive atoms which decay exponentially with respect to time.

The display shows the 196 atoms decaying randomly within a square and there
is a continuous tally of the numbers of atoms which remain undecayed and
those which have decayed as time passes. The display also gives an
activity/time graph and the half life on two separate occasions.

Line 10 Sets up Dim space for 196 atoms. Variables X and Y give the number
of decayed and undecayed atoms respectively. The variable E stands for the
total number of attempts which the computer makes at finding an undecayed
atom  this is equivalent to total time. "V" is used to give the correct
number of"-" in subroutine 400.

"I" and "J" are selected randomly - if A$(I,J) is null then the display
shows a pixel unplotted simulating the decay of that particular atom.
A$(I,J) is then made equal to one and the tally altered. If A$(I,J) is not
null, there is no change except in the time tally. A pixel showing the
number of undecayed atoms is plotted every 14 attempts.
