home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d597 / gold.lha / GoLD / GoLD.doc < prev    next >
Text File  |  1992-02-01  |  14KB  |  327 lines

  1.                        GoLD: GAME OF LIFE - DUO
  2.                        ========================
  3.  
  4.                                  by
  5.  
  6.                           Andreas Neubacher
  7.  
  8.                             January, 1992
  9.  
  10.  
  11.  
  12. 1. OVERVIEW (or: Let's see what we can do in the commercial style.)
  13. ===================================================================
  14.  
  15.  
  16. GoLD is an innovative new  "Game of Life" implementation. What makes it
  17. different is having two kinds of cells compete with each other for living
  18. space.
  19.     GoLD allows free redefinition of the rules with a few mouseclicks, so
  20. that a multitude of interesting phenomena like parasitism, virus attacks,
  21. etc. can be simulated.
  22.     GoLD also boasts a nice icon, full mousecontrol, highly optimized
  23. assembler subroutines to speed up computation, and a 2 player game mode.
  24.     GoLD comes packaged with complete, well documented source enabling you
  25. to rebuild the executable and clear, extensive documentation.
  26.     GoLD is free of any copy protection or password check. As a special
  27. bonus all files of the package may be distributed freely via any medium you
  28. can think of. Use of the program does not require the payment of license or
  29. shareware fees or sending a postcard or e-mail to the author.
  30.  
  31.  
  32.  
  33. 2. WHAT IS THE "GAME OF LIFE"? (or: I know it is a cellular automaton but
  34. =========================================================================
  35.                      I'm not interested in Theoretical Computer Science.)
  36.                      ====================================================
  37.  
  38.  
  39. 2.1. The classic version
  40. ------------------------
  41.  
  42. The game is played on an arbitrarily large, two-dimensional matrix. Its
  43. cells can exist in one of the two states "dead" or "alive". During every
  44. turn the following three rules are applied to each cell:
  45.  
  46. - If the cell is "dead" and exactly three of the eight neighbouring cells
  47.   are "alive", the cell is "alive" at the beginning of the next turn.
  48.  
  49. - If the cell is "alive" and less than two or more than three neighbouring
  50.   cells are "alive", the cell is "dead" at the beginning of the next turn.
  51.  
  52. - Otherwise, the state of the cell does not change.
  53.  
  54. This simple set of rules already creates astonishing complex patterns from
  55. simple ones (e.g. the R-Pentomino which grows from 5 cells to more than
  56. 200) and allows for strange behaviour of certain cell colonies (e.g. the
  57. Glider which moves one cell right and down every four turns):
  58.  
  59.                   ..O                   .OO
  60.                   O.O    Glider         OO.   R-Pentomino
  61.                   .OO                   .O.
  62.  
  63.  
  64. 2.2 The GoLD version
  65. --------------------
  66.  
  67. GoLD extends the number of states to three: "blue", "black", and "red" with
  68. values -1, 0, and +1, respectively. During every turn the values of the
  69. eight neighbouring cells are added up for each cell. Using this sum and the
  70. current state of the cell, the new state of the cell is looked up in a
  71. "Transformation Table". This makes for an pretty large number (3 to the
  72. power of 51) of different rule sets, one of which corresponds to the rules
  73. of the classic version.
  74.  
  75. Below is the transformation table for the classic rules as an example:
  76.  
  77.      +------------+--------------------------------------------------+
  78.      |            |       Sum of values of neighbouring cells        |
  79.      | Old state  |                                                  |
  80.      |            |-8|-7|-6|-5|-4|-3|-2|-1| 0|+1|+2|+3|+4|+5|+6|+7|+8|
  81.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  82.      | blue  "BL" |  |  |  |  |  |BL|BL|  |  |  |  |  |  |  |  |  |  |
  83.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  84.      | black "  " |  |  |  |  |  |BL|  |  |  |  |  |RD|  |  |  |  |  |
  85.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  86.      | red   "RD" |  |  |  |  |  |  |  |  |  |  |RD|RD|  |  |  |  |  |
  87.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  88.  
  89. Rows correspond to the state of the cell currently being checked, columns
  90. correspond to the sum of the values of this cells neighbours (with blue
  91. ones counting as -1, black ones counting as 0, and red ones counting as +1)
  92. and the entries of the table give the new state of the cell at the
  93. beginning of the next turn ("BL" for blue, "  " for black, and "RD" for
  94. red).
  95.     For example, the entry "RD" in the middle "black" row and the column
  96. denoted "+3" means that a black ("dead") cell changes to red ("alive") if
  97. it has exactly three red neighbours and no blue ones (+3-0 = +3), or four
  98. red neighbours and one blue one (+4-1 = +3), or five red neighbours and two
  99. blue ones (+5-2 = +3).
  100.     So if there are only cells of one color on the playfield, the above
  101. table lets them behave as in the classic game. This is also the default
  102. transformation table, which can be changed with the "Rules" menu option
  103. (see Section 3.2.).
  104.  
  105.  
  106.  
  107. 3. INSTRUCTIONS FOR USE (or: Assume we have never seen a mouse before.)
  108. =======================================================================
  109.  
  110.  
  111. 3.1. The Screen
  112. ---------------
  113.  
  114. The lower three quarters of the screen consist of the playfield, a matrix
  115. of size 160 x 60. From now on it will be called "Agar" (from "agar agar", a
  116. culture medium for cells).
  117.     If the mouse pointer is in this area of the screen, pressing the left
  118. button sets cells of the chosen strain while pressing the right button
  119. clears cells of the chosen strain.
  120.  
  121. In the upper quarter of the screen there are three gadgets:
  122.  
  123. - Clicking "Strain 1" and "Strain 2" toggle the chosen strain, which is
  124.   indicated by a frame around the corresponding gadget.
  125.  
  126. - Pressing the left button while the mouse pointer is on the "Grow" gadget
  127.   starts the computation of turns, which continues until the button is
  128.   released again.
  129.  
  130. For each of the two strains two values are printed below their
  131. corresponding gadget:
  132.  
  133. - "Cells on Agar" shows how many cells of this strain there are on the
  134.   playfield.
  135.  
  136. - "Cells in Freezer" shows how many cells there are in storage off the
  137.   playfield. You can only set cells onto the Agar as long as there are
  138.   cells in the Freezer. Cells which are cleared from the Agar by pressing
  139.   the right mouse button are moved to the Freezer.
  140.  
  141.  
  142. 3.2. The Menus
  143. --------------
  144.  
  145. When the mouse pointer is not located on the Agar, the right mouse button
  146. activates the menus:
  147.  
  148. 3.2.1 The "Project" Menu
  149. ------------------------
  150.  
  151. - "About" activates the "About" requester which also appears at startup.
  152.  
  153. - "Rules" shows a requester which contains the transformation table
  154.   explained in section 2.2. Clicking an "X" toggles its color (blue - black
  155.   - red).
  156.  
  157. - "Reset" clears the Agar and activates a requester with two gadgets for
  158.   each strain:
  159.   - "Cells in Freezer" gives the initial number of cells in the Freezer.
  160.   - "Growth in Freezer" gives the number of cells which are added to the
  161.     Freezer after every turn. See Section 4.2. for an explanation why the
  162.     concept of the Freezer was introduced.
  163.  
  164. - "Quit" ends the program.
  165.  
  166. 3.2.2. The "Edit" Menu
  167. ----------------------
  168.  
  169. - "Undo" resets the Agar to the state it was in before the latest
  170.   activation of the "Grow" gadget or editing of the Agar.
  171.  
  172. - "Clear Agar" sets all cells in the Agar to the color black.
  173.  
  174.  
  175.  
  176. 4. PLAYING SUGGESTIONS (or: I don't know what you can do with it, either.)
  177. ==========================================================================
  178.  
  179.  
  180. 4.1. Single Player
  181. ------------------
  182.  
  183. Just draw some random patterns of cells of both colors, let them grow a
  184. bit, change the rules, let them grow again, etc. The following tables may
  185. provide a starting point for your intuition w.r.t. interesting rules:
  186.  
  187. Some nice symmetry - just place 5 to 10 clusters of about 10 cells on the
  188. Agar:
  189.      +------------+--------------------------------------------------+
  190.      |            |       Sum of values of neighbouring cells        |
  191.      | Old state  |                                                  |
  192.      |            |-8|-7|-6|-5|-4|-3|-2|-1| 0|+1|+2|+3|+4|+5|+6|+7|+8|
  193.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  194.      | blue  "BL" |  |  |  |  |  |BL|BL|  |  |  |  |  |  |  |  |  |  |
  195.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  196.      | black "  " |  |  |  |  |  |BL|BL|  |  |  |RD|RD|  |  |  |  |  |
  197.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  198.      | red   "RD" |  |  |  |  |  |  |  |  |  |  |RD|RD|  |  |  |  |  |
  199.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  200.  
  201. Another symmetric rule - just place a single cell of each color on the Agar
  202. and watch how they develop and how the interaction of the two strains
  203. destroys the symmetry:
  204.      +------------+--------------------------------------------------+
  205.      |            |       Sum of values of neighbouring cells        |
  206.      | Old state  |                                                  |
  207.      |            |-8|-7|-6|-5|-4|-3|-2|-1| 0|+1|+2|+3|+4|+5|+6|+7|+8|
  208.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  209.      | blue  "BL" |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
  210.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  211.      | black "  " |  |  |  |  |  |  |  |BL|  |RD|  |  |  |  |  |  |  |
  212.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  213.      | red   "RD" |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
  214.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  215.  
  216. Blue is some kind of virus - it grows from healthy red cells and never
  217. dies:
  218.      +------------+--------------------------------------------------+
  219.      |            |       Sum of values of neighbouring cells        |
  220.      | Old state  |                                                  |
  221.      |            |-8|-7|-6|-5|-4|-3|-2|-1| 0|+1|+2|+3|+4|+5|+6|+7|+8|
  222.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  223.      | blue  "BL" |BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|
  224.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  225.      | black "  " |  |  |  |  |  |  |  |  |  |  |RD|RD|  |  |  |  |  |
  226.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  227.      | red   "RD" |  |  |  |  |  |  |  |  |  |  |RD|RD|BL|  |  |  |  |
  228.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  229.  
  230. Another virus, but this one's even deadlier - start with the entry in the
  231. "black" row, "+3" column set to RD, grow red cells until they nearly fill
  232. the screen and then toggle just this entry to blue and watch how fast the
  233. red cells are transformed. It is also interesting to watch the evolution of
  234. a square of 2x2 red cells according to these rules:
  235.      +------------+--------------------------------------------------+
  236.      |            |       Sum of values of neighbouring cells        |
  237.      | Old state  |                                                  |
  238.      |            |-8|-7|-6|-5|-4|-3|-2|-1| 0|+1|+2|+3|+4|+5|+6|+7|+8|
  239.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  240.      | blue  "BL" |BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|BL|
  241.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  242.      | black "  " |  |  |  |  |  |  |  |  |  |  |RD|BL|  |  |  |  |  |
  243.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  244.      | red   "RD" |  |  |  |  |  |  |  |  |  |  |RD|RD|  |  |  |  |  |
  245.      +------------+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  246.  
  247. I cannot recommend trying to design certain patterns of cells with special
  248. behaviour. GoLD was rather written for experimenting with the rules. This
  249. might change if somebody (No, not me!) added a "Zoom" option to the "Edit"
  250. menu and a "Cluster" menu with "Copy", "Paste", and "Save" options ...
  251.  
  252.  
  253. 4.2. Two Players ("Game mode")
  254. ------------------------------
  255.  
  256. The concept of the Freezer (see Section 3) was introduced to allow for some
  257. kind of two player competition:
  258.     Using the "Project" menu option "Reset" you choose an initial number of
  259. cells for each player.
  260.     Blue starts by setting some cells on the Agar. Then the "Grow" gadget
  261. is activated for some fixed number of turns. Now it's red's turn, who also
  262. sets some cells and then activates the "Grow" gadget. The game continues in
  263. this fashion until one of the players neither has cells on the Agar nor in
  264. the Freezer.
  265.     Complexity can be enhanced by allowing the players to optionally modify
  266. the rules (e.g. by at most two mouse clicks) instead of editing the cells
  267. on the Agar.
  268.  
  269.  
  270.  
  271. 5. COMPILING (or: You have the executable, why would you want to recompile?)
  272. ============================================================================
  273.  
  274.  
  275. GoLD was written using the DICE Compiler, which can be found in the Fish
  276. Library. Compilation is done by
  277.  
  278.   >dcc GoLD.c GoLDSub.a -o GoLD
  279.  
  280. The source should be completely compatible to the Lattice/SAS C Compiler.
  281. With Aztec you may have some problems:
  282.  
  283. - In "GoLDSub.a" the "section GoLDSub,code" statement must be replaced by
  284.   "CSEG" and the "xdef" statements must be replaced by "PUBLIC" according
  285.   to some obscure sources who claim to have knowledge of these things.
  286.  
  287. - Possibly the "dbf" opcode should be "dbra" for the Aztec Assembler and
  288.   the compiler might not push all function parameters as 32 bit values on
  289.   the stack (compiling with the option which sets integers to 32 bits might
  290.   help).
  291.  
  292. I neither have Lattice nor Aztec, so I could not test for compatibility.
  293.  
  294.  
  295.  
  296. 6. DISCLAIMER (or: Yes, this software is really free.)
  297. ======================================================
  298.  
  299.  
  300. Apart from the claim that I (see my address below) toiled uncounted hours
  301. developing this extraordinary piece of software, I don't reserve any rights
  302. or claim any kind of copyright for GoLD.
  303.     I wrote this for fun and out of interest, and I am using such a lot of
  304. Public Domain software that I thought I should donate something, too.
  305.     If you paid more than a moderate copying fee for GoLD ("moderate" being
  306. in the range of what Fred Fish charges), then
  307. (1) you won't be able to read this sentence because the distributor removed
  308.     it, and
  309. (2) you got ripped off and should try to find some other source for Public
  310.     Domain Software.
  311.  
  312.  
  313.  
  314. 7. THE AUTHOR'S ADDRESS (or: No, I don't expect any fanmail.)
  315. =============================================================
  316.  
  317.  
  318. Andreas Neubacher
  319.  
  320. Hausleitnerweg 26
  321. 4020 Linz
  322. Austria
  323.  
  324. e-mail: aneubach@risc.uni-linz.ac.at  (Internet)
  325.          k318577@alijku11             (Bitnet)
  326.  
  327.