DEFINITION MODULE LifeModule;

(* objects needed by Life and life Editor programs *)
(* J. Andrea, 1984 *)
(* This code may be freely used and distributed, it may not be sold. *)


EXPORT QUALIFIED 
    (* CONSTs *)
    screen_row_min, screen_row_max, screen_col_min, screen_col_max,
    title_row,      title_col,;
    label_1_row,    label_1_col,  label_2_row, label_2_col,
    menu_row,       menu_col,
    q_row,          q_col,

   (* TYPEs *)
    LifeFunction, Generation,

    (* VARs *)
    ekg, all_dead,

    (* PROCEDUREs *);
    Genesis, Genesis2, PlayGod, ShowBirths, ShowGeneration;



CONST
G
    screen_row_min = 2;      (* the coordinates of the playing field *)
    screen_row_max = 23;
    screen_col_min = 2;
    screen_col_max = 50;

    title_row = 4;
    title_col = 55;


    label_1_row =  8;        (* generation number *)
    label_1_col = 55;
    label_2_row = 10;        (* population size *)
    label_2_col = 55;


    menu_row = 17;           (* menu of options *)
    menu_col = 55;

    q_row = 21;              (* position for NEXT GENERATION question *)
    q_col = 55;


TYPE
   LifeFunction = (dead,alive);
   Generation = ARRAY [screen_row_min-1..screen_row_max+1] OF
                ARRAY [screen_col_min-1..screen_col_max+1] OF LifeFunction;


VAR
   ekg       :ARRAY [dead..alive] OF CHAR;
   all_dead  :Generation;




    PROCEDURE Genesis;
    (* read a set of coordinates (row,col) of positions that are to
       be set to ALIVE positions *)




    PROCEDURE Genesis2( VAR new :Generation; VAR population :CARDINAL );
    (* read a set of coordinates (row,col) of positions that are to
       be set to ALIVE positions *)
    (* for MAKELIFE, no error reporting *)



    PROCEDURE PlayGod;
    (* play the game *)




    PROCEDURE ShowBirths( new , old :Generation; VAR changes :CARDINAL);
    (* show the difference between the two generations *)



    PROCEDURE ShowGeneration( new :Generation );
    (* put up a boundary and show the generation *)


END LifeModule.
