-- FILE: life.adb -- AUTHOR: E.Burke -- DATE: November, 1996 -- PURPOSE: Driver procedure for Game of Life with Grid; procedure Life is -- Package GRID contains generic specification of BOARD and all -- operations needed to play the Game of Life package Life_Grid is new GRID (MAX_ROWS => 20, MAX_COLUMNS => 50, MAX_SIZE => 50); T : Life_Grid.BOARD; Again : BOOLEAN; begin Life_Grid.Initialize(T); -- Set all cells to 'dead' (false) Life_Grid.Input(T); -- Allow user to input coordinates -- of 'alive' cells Life_Grid.Output (T); -- Display cells (initial pattern) Again := Life_Grid.Enquire; -- Ask user whether to continue -- for another update cycle while Again loop Life_Grid.Update_Box (T); -- Change cells to alive or dead depending -- on status of neighbors Life_Grid.Output (T); -- Display cells (updated pattern) Again := Life_Grid.Enquire; end loop; end Life; -- comments by G. Levine -- You should declare the values that are used to instantiate the Grid, -- MAX_SIZE, MAX_ROWS, MAX_COLUMNS, as constants (or else allow the player -- to input their values). -- For Reuse, we do not use literals. -- You might also consider the Ada construct, -- loop -- exit when not Life_grid.Inquire; -- Life_Grid.Update_Box(T); -- Life_Grid.Output (T); -- end loop; -- I would also recommend an exception handler, when others => -- as a feature to guarantee retaining control.