LIFE A Simulation of the Famous Game of Life For Windows 3.0 Version 1.1 May 27, 1991 Copyright 1991 Tom Wheeler [72037,1742] The programs and documentation contained herein are hereby placed in the public domain. You may use any portion of this material as you see fit for your own personal use provided no part of anything contained herein is used or distributed commercially. This material may not be distributed unless all modules listed below are included in the final distributed version: HAND CUR 326 05-15-91 9:10p LIFE C 35455 05-27-91 5:48p LIFE DEF 410 05-18-91 9:30p LIFE EXE 35984 05-27-91 5:48p LIFE H 571 05-18-91 2:53p LIFE ICO 766 05-14-91 8:42p LIFE MAK 2267 05-27-91 5:11p LIFE RC 2593 05-22-91 10:33p README TXT 5725 05-29-91 8:38p No claim of suitability of use is made for these programs. The user is solely responsible to determine whether or not these programs perform properly on any given computer system. This program provides a simulation of Life for Windows 3.0. This is one of the more common simulations available in one form or another for just about every computer ever made. The algorithm used to manipulate the cells was borrowed and heavily modifed from a Turbo Pascal for Windows program available on Compuserve in the Borland Forum named "PLIFE". The rules of the basic simulation are simple. If a "dead" cell has exactly 3 neighbor cells, it is born (displayed as a green rectangle). If an "alive" cell should ever have less than 2 neighbors it dies (of lonliness, I presume). If an "alive" cell should ever have more than 3 neighbors it also dies (overcrowding). The simulation proceeds from cycle to cycle, calculating and updating the status of each cell displayed on the screen. This version adds a twist to the basic simulation. Every ten cycles that a cell is alive, it ages (transforms to a different state indicated by a change in color). When a cell becomes too old (after 8 age cycles), it dies off regardless of the above conditions. The world that the cells exist within consists of a 100 X 100 grid. The grid does not wrap, that is, cells at the far left do not know about cells at the far right and cells at the top do not know about cells at the bottom. When first started, an empty cell matrix is displayed. You may place individual cells wherever you like by positioning the hand cursor over an empty cell and clicking the left mouse button. After placing the desired cells, cycle the matrix by selecting "Start" or "Step" from the "Run" menu. Cells may be added or deleted at any time by using the mouse as above. If you do not place any cells, this program will randomly fill the grid with "alive" cells for you. To summarize functions available: RUN HOTKEY DESCRIPTION ---------- -------- --------------------------------------------------- Start ^R Starts automatic cycling of the matrix. The matrix cycles when a predefined timer expires. Stop ^R Stops automatic cycling of the matrix. Step ^E Cycles the matrix once. Only available when the matrix is not in automatic cycle mode. OPTIONS HOTKEY DESCRIPTION ---------- -------- --------------------------------------------------- Clear ^C Clears the matrix. If it is automatic cycle mode, it turns this feature off as well. Grid On ^G Turns Gridlines ON. Grid Off ^G Turns Gridlines OFF. Set Timer ^T Allows entry of a different time value for the cycle timer. Valid entries are 100-999 (milliseconds). Small Grid ^S Displays the smallest possible grid size (zooms out) Medium Grid ^M Displays the default grid size Large Grid ^L Displays the largest possible grid size (zooms in) You may move around the matrix by using the scroll bars and zooming in and out (also up, down, left, right, pgup, and pgdown keys work). In the interest of run time efficiency (speed), only the cells actually displayed are cycled. Therefore, any cells defined but not displayed remain stationary. If you move to an uninhabitated area while in automatic cycle mode, the program will automatically fill it with a random pattern of cells. NOTE: When in automatic cycle mode with the window zoomed to full screen and Small Grid size selected, this program can take a lot of CPU time to run (even on a fast 386/486 machine). It is best to find a combination of grid size and window size that does not hog a lot of system time. The default size does not seem to be too much of a burden even on slower PCs. You can also increase the timer value to > 500 milliseconds to decrease the amount of overhead this program requires. This program was written as an experiment to try out various Windows API functions, primarily the use of GDI Graphics calls and Scroll Bar manipulation. The make file was generated using the PWB (Programmers Work Bench) included with Microsoft C 6.00a. The program was compiled and linked with Microsoft C 6.00a and Link 5.1.