home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / games / biglife3 / biglife.doc next >
Text File  |  1993-12-20  |  20KB  |  519 lines

  1.              BigLife Version 3.00
  2.              ====================
  3.             A life player for big patterns
  4.  
  5.             Copyright © 1993 Owen Rees
  6.  
  7. Permission to use, copy and distribute BigLife is granted, provided that
  8. any distribution includes the .PRG .RSC and .DOC files in their original
  9. form. A moderate charge may be made for media, duplication, transmission
  10. etc.
  11.  
  12. Distributors may use their own judgement about how many patterns to
  13. include.
  14.  
  15. 0) Contents
  16.    1) How to use Biglife
  17.    2) File formats
  18.    3) What is 'Life', further reading, more patterns
  19.    4) About the author, acknowledgements, history, future etc.
  20.  
  21.  
  22. 1) How to use Biglife
  23.  
  24. It's a GEM program and I have tried to make the menus and dialogs easy
  25. to understand so that, if you want to, you can try it out without
  26. reading any further.
  27.  
  28. BIGLIFE.RSC must be in the current folder when you run BIGLIFE.PRG, keep
  29. them in the same folder to run from the desktop.
  30.  
  31. When it is loaded you get a GEM window with all the usual controls, and
  32. a menu bar. Here is a summary of the menu items followed by more
  33. detailed descriptions.
  34.  
  35. Desk:    About life...    Version number, data about the current pattern.
  36.     Desk accessories, if any.
  37.  
  38. File:    Clear        Clear the universe.
  39.     Revert        Revert to loaded pattern.
  40.     Load Xlife...    Clear universe and load Xlife file (formats below) 
  41.     Save Xlife...    Save universe as Xlife file (formats below)
  42.     Load IMG...    Clear universe and load IMG
  43.     Save IMG...    Save as IMG
  44.     Quit        For when you have had enough
  45.  
  46. Actions:Go        Run at selected speed until key press
  47.     Step        Do one generation
  48.     Redraw        Clear window and redraw pattern
  49.     Centre        Move centre of window to centre of pattern
  50.     Reset counters    Zero the generation and time counters
  51.  
  52. Options:Display...    Dialog to set the display style
  53.     Speed...    Dialog to set the speed limit
  54.     Rules...    Choose rules for life variants
  55.     Edges...    Set edges of universe
  56.     Show Info    Show generation number in title line
  57.  
  58. About Life...
  59.  
  60. Tells you:
  61.    the version number of the program and the name of the author,
  62.    the name of the current pattern,     ) editable fields
  63.    the 'owner' (creator) of the pattern ) see File format below
  64.    the first three comment lines        ) 
  65.    the cell count, generation number, the run time, average speed and
  66. average time to compute a generation.
  67.    the size and position of the pattern
  68.    the size and position of the window (in cells)
  69.    the size of the workspace and how much is in use: sizes of current
  70.        and previous patterns are given separately.
  71.  
  72. In Low resolution some of the information is omitted, and none of the
  73. fields are editable (so that you don't accidentally lose half the
  74. information.)
  75.  
  76.  
  77. Display dialog:
  78.  
  79. This lets you select the cell size for display, the cell and background
  80. colours and the function used to draw the display.
  81.  
  82. There is a selection of cell display sizes in two shapes so that you can
  83. choose reasonably square cells in low, medium or high resolution. This
  84. affects how much of the pattern you can see but not the pattern itself.
  85.  
  86. The squash factor determines how many life cells are mapped to each
  87. display cell. This allows you to see the overall shape of large
  88. patterns. The number is the length of the side of the square that maps
  89. to each display cell. For example, at squash factor 2, you see twice
  90. the width and twice the height but with less detail.
  91.  
  92. The colour stuff is really just for fun. The one with the black spot in
  93. the middle is the selected colour. I have only given you eight of the
  94. low res colours - you can only use two at a time anyway.
  95.  
  96. The VDI and LineA buttons select which function gets called to do the
  97. output. LineA is slightly faster but Atari has declared it obsolete.
  98. For the technically minded, the choice is between the VDI vrt_cpyfm
  99. and the Line A bitblt.
  100.  
  101.  
  102. Speed dialog:
  103.  
  104. This sets a speed limit, measured in generations per second. Max means
  105. as fast as possible and if selected BEFORE you select Go will disable
  106. all the controls until you press a key on the keyboard to stop the
  107. run.  With any other speed, the menus remain active. If you select Max
  108. while running, the menus remain active so you have to select Go again
  109. to get full speed.
  110.  
  111. Note that this is a speed limit rather than a delay between generations.
  112. All speeds above the speed at which the pattern can be computed are
  113. equivalent. The time taken to compute the new generation is subtracted
  114. from the delay.
  115.  
  116. Rules dialog:
  117.  
  118. The rules dialog lets you specify the birth and survival rules. Select
  119. which neighbour counts should cause a birth in a dead cell, and which
  120. neighbour counts should cause survival in a live cell. There are
  121. buttons to set the dialog to the standard rules and to the 3-4 rules -
  122. one of the better known variations.
  123.  
  124. Edges dialog:
  125.  
  126. The edges dialog lets you specify smaller universes, with either open
  127. or connected edges. All cells beyond an open edge are permanently
  128. dead. A connected edge acts as if it were next to the opposite edge of
  129. the universe. By connecting one or both pairs of edges, the universe
  130. can be made cylindrical or toroidal. Specifying 'no edge' is
  131. equivalent to open edges at -32767 and 32767 except for the way scroll
  132. bars operate. Specifying edges slows things down.
  133.  
  134. Window controls:
  135.  
  136. The close box does the same as Quit in the File menu. The title shows
  137. the name of the loaded file and, optionally, the number of generations
  138. since load (or counter reset). The generation counter will be updated
  139. dynamically if there is enough time. The full box, size box and move bar
  140. do the usual resizing and moving.
  141.  
  142. If edges have been specified, the scroll bars show the size and
  143. position of the window relative to the universe - it can be hard to
  144. find a small pattern in a large universe with edges turned on.
  145.  
  146. If 'no edge' has been specified, the scroll bars show you the size and
  147. position of the window over an area that includes the pattern plus a
  148. border the height/width of the window, and also includes the window
  149. itself. This may sound a bit odd but try loading the glider, scrolling
  150. the window so that it is in the top left corner (you need the border
  151. to be able to do that) then let it run for about 10 seconds at maximum
  152. speed. The glider crosses the screen and disappears into the distance.
  153. When you stop it, the scroll bars show that you are looking at the
  154. corner of a large area.  Scroll the window towards the pattern and the
  155. scroll bars start to get bigger until you get to the pattern again.
  156.  
  157. If you set a slow enough speed limit, the scroll bars will change
  158. dynamically as the pattern evolves.
  159.  
  160.  
  161. Pattern editing:
  162.  
  163. There is a very primitive and slow pattern editing facility. Pressing
  164. the left mouse button makes the cell under the pointer live, pressing
  165. the right mouse button makes it dead.
  166.  
  167.  
  168. 2) File Formats
  169.  
  170. Biglife will read and write the Xlife file format. (Xlife is a freely
  171. available life player for the X Window System.) It will also read and
  172. write IMG format files.
  173.  
  174. Loading Xlife:
  175.  
  176. The file consists of a number of pattern sections which are merged to
  177. make the complete pattern. The file, and any additional files from
  178. which patterns are included, are read to form a load script. This
  179. script is then processed to build the pattern. The 'Revert' menu item
  180. rebuilds the pattern from the script - this can take a long time for
  181. some pattern scripts.
  182.  
  183. Each section starts with a header line that
  184. starts with a '#' followed by a format character that specifies the
  185. format of the section.
  186.  
  187. Biglife supports the following section formats:
  188.  
  189. A -- Absolute. The header is followed by lines consisting of a pair of
  190. numbers that specify absolute (x,y) coordinates. For example, a row of
  191. three cells centred on (10,10) would appear as:
  192.  
  193. #A
  194. 9 10
  195. 10 10
  196. 11 10
  197.  
  198. R -- Relative. Like absolute but with an offset specified on the
  199. header line. If the offset is omitted it is taken to be 0 0. The same
  200. row of three cells could be specified as:
  201.  
  202. #R 10 10
  203. -1 0
  204. 0 0
  205. 1 0
  206.  
  207. P -- Picture. Each following line down to a line that starts with # or
  208. to the end of the file is interpreted as a scan line of an image
  209. starting at an offset specified on the header line. If the offset is
  210. omitted it is taken to be 0 0. A '*' causes the corresponding cell to
  211. be live, any other character leaves it alone.  Note that it does not
  212. force the cell to be dead, the cell may have been specified as a live
  213. cell in another section. It is conventional to use '.' because this
  214. makes it easier to count cells without obscuring the pattern.
  215.  
  216. The leftmost column has the specified x value, with x increasing to
  217. the right. The line starting #P has the specified y value but is not
  218. taken as part of the picture: y increases down the file. Therefore, y
  219. values effectively start at the specified offset plus one. (N.B. In
  220. biglife versions 1 and 2, the line following the #P was taken to have
  221. the specified y offset. This consistent offset did not matter unless
  222. the input contained both #P and other pattern formats. This offset had
  223. to be corrected for #I to work in the same way as Xlife.)
  224.  
  225. The row of three in picture format could be represented as:
  226.  
  227. #P 9 9
  228. *** and this text would be ignored
  229. and this is equivalent to a blank line.
  230.  
  231. B -- Block. Start of a named block for use with #I.
  232. E -- End of block. End of the block named by a preceeding #B.
  233.  
  234. Sections between a #B and a #E line form a named pattern.  These are
  235. not loaded as part of the main pattern, but may be included by the use
  236. of #I. The pattern name follows the #B, e.g.
  237.  
  238. #B oscil
  239. #P
  240. ..*...
  241. .*.*..
  242. *...**
  243. *...**
  244. *...**
  245. .*.*..
  246. ..*...
  247. #E
  248.  
  249. Pattern block definitions may not be nested. In other words, after a
  250. #B there must be a #E before the next #B. Note that #I may occur in a
  251. named block, and may refer to a block that contains further #Is,
  252. provided that a block does not directly or indirectly include itself.
  253.  
  254. I -- Include. Include a named pattern with transformation.
  255. A #I is followed by up to 6 values as follows:
  256.  
  257. #I patname x y  rotate  flip  delay
  258.  
  259. The patname value must be given: defaults for the other values are
  260. #I patname  0 0 0 1 0
  261.  
  262. patname - the name of the pattern to be included; this takes one of
  263. the forms
  264. file:pattern    the .LIF extension is added to the file name and the
  265.                 named pattern is loaded from that file.
  266. file        as above except that the main pattern from the file is
  267.                 loaded (i.e. the one outside #B #E).
  268. :pattern    the named pattern is loaded from the current file.
  269.  
  270. x y   - the offset at which the pattern is to be loaded; this offset is
  271.         applied after the other transformations. In an attempt at
  272.     consistency with Xlife, the offset is not applied to sections
  273.     introduced by #A. There are no examples of this usage and it
  274.     is best avoided.
  275.  
  276. rotate- the number of clockwise quarter (i.e. 90 degree) turns to
  277.         apply to the included pattern; this rotation is applied after
  278.     the flip has been processed.
  279.         Note that Y values increase down the screen so a cell at (1,0)
  280.         will be rotated to (0,1) if the rotate value is 1 - this is
  281.     the opposite of the usual sense of rotation in cartesian
  282.     coordinates.
  283.  
  284. flip  - if this value is -1, the Y values in the pattern are negated,
  285.     otherwise they are left alone. This is the first
  286.     transformation applied to the named pattern.
  287.  
  288. delay - if the delay value is positive, then the include is delayed
  289.         for that number of generations. In other words, the rest of
  290.         the pattern is run for the specified number of generations
  291.         before the included pattern is merged into it.
  292.  
  293. For example, the file SHUTTLE.LIF contains the named pattern 'oscil'
  294. shown above, and the following three includes.
  295.  
  296. #I :oscil 12 0 0 1 0
  297. #I still:block 21 3 0 1 4
  298. #I still:block 1 3 0 1 19
  299.  
  300. The first include causes the pattern 'oscil' to be loaded with offset
  301. (12,0) - it is not rotated or reflected. That pattern is then run for
  302. four generations, and the pattern 'block' from the file STILL.LIF is
  303. merged in with offset (21,3). The merged pattern is then run for a
  304. further 15 generations (i.e. a total of 19 since 'oscil' was loaded)
  305. and another copy of 'block' is merged in with offset (1,3). Since
  306. there are no outstanding includes, the load is complete.
  307.  
  308. The file still.lif includes the following:
  309.  
  310. #B block
  311. #P
  312. **
  313. **
  314. #E
  315.  
  316. Patterns defined with #I can take a long time to load. For example,
  317. the breeder script involves running the pattern for 965 generations
  318. before the load is complete. This took 196 seconds (3 min 16 sec) on
  319. my STe last time I measured it, but it is interesting to watch the
  320. pattern being built up. All the usual controls are available during
  321. the load.
  322.  
  323. N -- Name of pattern. If specified, it appears in the "About Life..."
  324. dialog. For example, the row of three cells:
  325.  
  326. #N blinker
  327.  
  328. O -- Owner. Information about the person who created the pattern. The
  329. form should be: 'id "name"@machine date', which doesn't necessarily
  330. make a lot of sense for a home computer. If specified, this appears in
  331. the "About Life..." dialog too. If I was going to put one of these on
  332. a file I would use something from which you can probably deduce my
  333. Internet email address:
  334.  
  335. #O rtor "Owen Rees"@ansa.co.uk Mon 15 Mar 1993 21:00
  336.  
  337. C -- Comment. The first three such lines are saved and appear in the
  338. "About Life..." dialog. Use these for comments about the pattern. For
  339. example:
  340.  
  341. #C This is a very common oscillator of period two
  342.  
  343. # -- Another kind of comment. These get discarded. Use these for
  344. comments about the file itself. For example:
  345.  
  346. ## next section is a blinker in relative format.
  347.  
  348. For compatibility with the original Xlife format, a file consisting
  349. only of lines with coordinate pairs will be read as a single absolute
  350. section.
  351.  
  352. Saving Xlife:
  353.  
  354. If the pattern has a name, owner, or comments (as in #N, #O, #C above)
  355. then these will be written to the file (only the first three comment
  356. lines are remembered so only they will be saved.)
  357.  
  358. The pattern is saved as a single picture (#P) section if it is less
  359. than 72x100, and a single relative (#R) section otherwise.
  360.  
  361. Loading IMG:
  362.  
  363. Biglife ignores the pixel size, it just takes each pixel as a cell.
  364. Cells are dead if unset in every plane; this will be white with the
  365. default pallette in your paint program. Biglife takes notice of the
  366. image width and height - not all paint programs do this so be prepared
  367. for problems. Biglife will read multi-plane (colour) images written by
  368. Hyperpaint-II; the format is different from the descriptions I have
  369. seen published, but the descriptions tend to be vague in this area.
  370.  
  371. Saving IMG:
  372.  
  373. The pattern is saved as a single plane image at 100dpi with the width
  374. rounded up to the next multiple of 8 and height used as is. I have
  375. successfully imported a saved pattern into PageStream, but there is
  376. scope for a lot of problems here.
  377.  
  378.  
  379. 3) What is 'Life', further reading, more patterns
  380.  
  381. Those who are familiar with 'Life' can skip the next bit...
  382.  
  383. Introduction to Life:
  384.  
  385. Life was invented by John H. Conway, a distinguished mathematician at
  386. the University of Cambridge. It is a 0 player game; you choose a
  387. starting pattern, the rules determine its successor patterns. The
  388. fascination is that it is very difficult to predict the fate of an
  389. arbitrary pattern, and you can set up patterns that interact in
  390. intricate and complex ways.
  391.  
  392. The Life universe is like a succession of infinitely large sheets of
  393. graph paper. Some of the squares are filled in, these are called live
  394. cells. Life proceeds in discrete steps, like the separate sheets of
  395. graph paper. Each pattern is derived from the previous one by the
  396. following rules:
  397.  
  398.       Birth: If the cell was dead in the old pattern, but three of its
  399.       eight neighbours were alive then it becomes alive in the new
  400.       pattern.
  401.  
  402.       Survival: If the cell was alive in the old pattern, and either
  403.       two or three of its eight neighbours were also alive then it
  404.       remains alive.
  405.  
  406.       Death: If the cell was alive and had less than two, or more than
  407.       three neighbours then it is dead in the new pattern.
  408.  
  409. The other cases are dead cells that remain dead because they do not
  410. have three neighbours.
  411.  
  412. Terminology:
  413.  
  414. Most of the conventional terminology was invented by Conway and other
  415. early experimenters. Here are some of the terms used in comments
  416. attached to the patterns, these are adopted from the books mentioned
  417. below:
  418.  
  419. Still life: a pattern that remains the same in the next generation.
  420.  
  421. Oscillator: a pattern that reappears some number of generations (the
  422. period) later.
  423.  
  424. Spaceship: a pattern that reappears in a new position some number of
  425. generations later. The smallest and most common spaceship is the
  426. glider.
  427.  
  428. Glider gun: a pattern like an oscillator but adding a glider at each
  429. repetition.
  430.  
  431. Puffer train: a pattern like a spaceship but leaving behind an
  432. 'exhaust' which stabilises to still lifes, oscillators, and sometimes
  433. spaceships.
  434.  
  435. Rake: a combined puffer train and glider gun. A puffer train is
  436. usually considered to be a rake if a large proportion of its exhaust
  437. is spaceships (usually gliders.)
  438.  
  439. Methusaleh: a small pattern that takes a long time to stabilise into
  440. still lifes, oscillators, and spaceships that will not run into any
  441. other part of the pattern.
  442.  
  443.  
  444. Further reading:
  445.  
  446. "Wheels, Life and other Mathematical Amusements" by Martin Gardner
  447. (Freeman 1983)
  448. A collection from his column in Scientific American, including the two
  449. articles which introduced Life to the general public, as well as a
  450. third chapter on Life written especially for the book.
  451.  
  452. "The Recursive Universe" by William Poundstone (Oxford University
  453. Press 1985) 
  454.  
  455. This book describes the history of Life, and includes a large number
  456. of patterns. It also includes some interesting excursions into
  457. information theory. The only weakness is in the description of how to
  458. program a life player.
  459.  
  460. Both those books give quite a few other references.
  461.  
  462. Patterns:
  463.  
  464. Biglife supports the Xlife file format so that it can use the large
  465. pattern library that is supplied with Xlife version 3.0. Almost all of
  466. the Xlife library was included (adapted for short file names) with the
  467. original distribution, with a few additions of patterns described in
  468. the books mentioned above.
  469.  
  470. I have added comments to some of the patterns which you can see using
  471. the "About Life..." dialog. Most of the comments use the terminology
  472. given above.
  473.  
  474. You should try at least the b heptomino puffer train PUFFRTRN.LIF and
  475. the breeder BREEDER.LIF, if only because Poundstone says they are too
  476. big for a home computer. It took just over 2 hours to track the puffer
  477. to its predictable state at generation 5533 on my STe.
  478.  
  479. I don't know of any other significant collections of patterns.
  480.  
  481.  
  482. 4) About the author, acknowledgements, history, future etc.
  483.  
  484. If you want to tell me how wonderful/awful the program is, you can
  485. send Internet e-mail to <rtor@ansa.co.uk> or write to me:
  486.  
  487.    R. T. O. (Owen) Rees
  488.    32 Highworth Avenue
  489.    Cambridge
  490.    CB4 2BG
  491.    England
  492.  
  493. Biglife was implemented in C using Sozobon2.0 (with some modifications
  494. of my own), GemFast1.8, emacs18.55 and gulam, and I would like to
  495. thank the authors of those programs for making it possible.
  496.  
  497. Version 1: published on the cover disc of ST Format issue 50
  498.  
  499. Version 2: uploaded to atari.archive.umich.edu on 12 July 1993.
  500.  - IMG file support
  501.  - fixes some bugs in the handling of large (>32767 cells) patterns.
  502.  
  503. Version 3: (December 1993)
  504.  - fixes bug: earlier versions can hang when scrolling
  505.  - fixes bug: more than three #C lines caused "unknown format" error
  506.  - support for #I,#B,#E xlife formats, and revert to loaded pattern
  507.  - Squashed display was added
  508.  - Alternative rules added
  509.  - Adjustable edges added
  510.  - speedup: input sorting is done only on the part of the input that
  511.         does not arrive in order
  512.  - speedup: various code restructuring to shorten critical loops
  513.  
  514. Version 4? Maybe one day. 
  515.    I have no idea what it might contain.
  516.  
  517. Time to stop reading and get on with Life.
  518.  
  519.