-- Assignment 1. -- Eugene Burke -- Oct 23, 1996 -- -- FILE: -- life1.adb -- uses life_game.ads, life_game.adb -- PURPOSE: -- Implement the game of life, an example of a finite automaton with Ada.Integer_Text_IO; with Life_Game; procedure Life1 is OldMap : Life_Game.GRID; Newmap : Life_Game.GRID; I : Life_Game.ROW; J : Life_Game.COL; Again : BOOLEAN; begin Life_Game.Initialize(OldMap); Life_Game.Write_Map(OldMap); Again := True; while Again loop for I in 1..Life_Game.MaxRow loop for J in 1..Life_Game.MaxCol loop case Life_Game.Neighbor_Count(I,J,OldMap) is when 0 | 1 => Newmap(I,J) := Life_Game.dead; when 2 => Newmap(I,J) := OldMap(I,J); when 3 => Newmap(I,J) := Life_Game.alive; when 4 | 5 | 6 | 7 | 8 => Newmap(I,J) := Life_Game.dead; when others => NULL; end case; end loop; end loop; OldMap := Newmap; Life_Game.Write_Map(OldMap); Again := Life_Game.Enquire; end loop; end Life1; -- COMMENTS -- Good first program, and you have begun putting Ada blocks together. -- However, the Grid should be generic, with the size of the Grid -- determined by the caller. -- Loop parameters are declared -- by default and are available to the program only in the body of the loop -- We must agree with style guides.