Programm-Rahmen

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]

GameOfLife.m2
(*
   Allgemeine Informatik I / Programmieren I    WS 1998/1999
   Musterloesung fuer das Blatt 12, Aufgabe 14
   Ingo Melzer und Andreas Borchert
*)
MODULE GameOfLive;

   FROM Arguments IMPORT InitArgs, GetFlag, FetchString,
      AllArgs, Usage;
   FROM ASCII IMPORT nl;
   FROM FtdIO IMPORT FwriteString, FwriteLn;
   FROM MainWin IMPORT WriteString, Write, WriteLn, Read,
      Flush, SetPos, Clear, lines, columns;
   FROM StdIO IMPORT FILE, MODE, Fopen, Fgetc, stdin, stderr;
   FROM SysExit IMPORT Exit;
   FROM SysPerror IMPORT Perror;

   (* ... *)

BEGIN
   Clear; Flush;
   ProcessArgs;
   IF ReadWorld(input, world, noflines, nofcolumns) THEN
      continue := FALSE;
      REPEAT
         NextGeneration(world, noflines, nofcolumns,
            newWorld);
         WriteWorld(world, noflines, nofcolumns);
         world := newWorld;
      UNTIL query & ~Weiter();
   END;
   SetPos(lines-1, 0); Flush;
END GameOfLive.

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]
Copyright © 1999 Andreas Borchert, in HTML konvertiert am 04.02.1999