An algorithm needed for computer simulation of immunodiffusion has been deduced from existing theories of the in vitro reaction between antibody and antigen. The "Goldberg most probable polymer distribution" theory provides a formula that gives the amount of free antibody, free antigen, and diffusible complexes from extreme antibody excess through extreme antigen excess for any valences of antibody and antigen. As is shown here, that formula can be used even for those reactions producing complexes, cyclical or otherwise, that may precipitate as well as for those reactions involving heterogeneity of binding avidities. It is necessary, however, to specify an extent of reaction parameter. Five limiting expressions for this parameter are proposed as options for the basic algorithm. These are identified as: (a) the "Heidelberger-Kendall complete reaction" option, (b) the "Singer-Campbell constant avidity" option, (c) the "Hudson extensive antibody heterogeneity" option, (d) a new "extensive antigen heterogeneity" option, and (e) the "Goldberg critical extent of reaction" option. Literature data showing need for the various options are presented.