<hmtl> <head> <title> Java Applet : Life Game </title> <meta name=owner content=ldavid@multimania.com> <meta name=security content=public> <meta name="description" content="Life Game Applet by Laurent David"> <meta name="keywords" content="Laurent David java applet life game">  </head>  <body background="backgnd.jpg" text="#0000FF" link="#ffffff" vlink="#ff0000" alink="#ff0000"> <center> <h1>   Java Applet : Life Game </h1>  <p> <img src="frenchline_624x5.gif" width=624 height=5> <p>  <a href="index.html"><img src="french.gif" width=51 height=32></a> <img src="english.gif" width=51 height=32>  <p> <img src="frenchline_624x5.gif" width=624 height=5> <p> </center>  <h2>This applet has been selected by Gamelan to be in the first "Best Of Java" book. At that time, I refused. Everybody makes mistakes.</h2>  <center> <p> <img src="frenchline_624x5.gif" width=624 height=5> <p> </center> <h2>The Overview of Life </h2>  The Life's game is a cellular animation originally developed by John Conway. It consists of a table of cells and a set of rules which describe how to find successive generations of the cells.  <center> <p> <img src="frenchline_624x5.gif" width=624 height=5> <p> </center> <h2>The Rules of Life </h2>  <ol> <li>For each populated cell in the table, count the number of neighbors to that cell : <dl> <lh>If it has 0 or 1 neighbors, the cell dies of 'loneliness'. <br> <lh>If it has 2 or 3 neighbors, the cell survives to the successive generation. <br> <lh>If it has 4 or more neighbors, the cell dies of 'overcrowding'. <br> </dl> <li>For each empty cell in the table, count the number of live neighbors to that cell :  <dl> <lh>If it has exactly 3 neighbors, it becomes populated. <br> </dl> </ol>  <center> <p> <img src="frenchline_624x5.gif" width=624 height=5> <p> </center> <h2>Features</h2> <ol> <li><h3>The field : </h3> <lh>A click on a cell can have several features : <dd> If the cell is empty (or dead, which means that it is in white), you place the selectioned pattern in that  cell. If the pattern is larger than 1x1 (all the cases except the first one), it gets extended to the right-bottom part of the cell. For more details, see the drop down list section below. <dd> If the cell is alive (all the colors except white), you remove the cell, and it turns to white. <br> <li><h3>The buttons : </h3> <dd> <b>Go ! : </b> A click on this button makes the applet run until a stable state is found. When the applet runs, the 'Go !' button turns to a 'Stop !' button. A click on the 'Stop !' button stops the evolution of the cells. <dd> <b>Step : </b> A click on this button enables you to view the next step on the evolution of the cells. <dd> <b>Clear : </b> A click on this button clears the whole field. <dd> <b>Debug : </b> A click on this button switches the applet in 'debug' mode. The 'debug' mode is useful for me to check out whether there is a bug in my applet. In 'debug' mode, a click on a cell prints out in the Java console the properties of that cell (position and neighbors). The 'debug' mode turns off the 'Go !' , 'Step' and 'Clear' buttons. To quit the 'debug' mode, click again on the 'debug' button. <br>You should not use the Debug mode. <br> <li><h3>The drop down lists : </h3> <dd> <b>Color mode : </b> You can set the applet to be either in color mode to have cells in different colors, or in black and white mode. <dd> <b>Cell size : </b> You can switch the cells' size between those values : 4,5,10,20,40. Those numbers describe the size of the cells in pixels. So when you pick up a big one, the cells will be big, the applet will run faster, but the field will contain less cells too ! Be aware that some of the patterns are really huge, so you would need small cells to get the correct displayed on the screen. <dd> <b>Pattern selection : </b> This list enables you to switch between 61 preselected shapes. The list is showing the name of the pattern, the subtype of that shape, and its dimensions. The pattern selected is drawn from the cell clicked towards the right-bottom direction of the field. The field is supposed to be cyclic, which means that the cells on the border are neighbors of each others. So, you have to set your field size correctly enough to have the place to draw your pattern. Otherwise, the result may be surprising (if a cell gets  drawn twice, it turns to the dead state). The different patterns subtypes are : <dd> Normal shape : 1 item <dd> Stable shape : 20 items <dd> Periodic shape : 15 items <dd> Methusaleh shape : 7 items <dd> Glider shape : 10 items <dd> Puffer shape : 3 items <dd> Fuse shape : 2 items <dd> Other shape : 3 items </ol>  <center> <p> <img src="frenchline_624x5.gif" width=624 height=5> <p> <h2>The game</h2>  <applet code="LCDLifeGame.class" width=641 height=475 align=center> <blockquote> <hr> If you were using a Java-enabled browser, you would see the java life game instead of this paragraph <hr> </blockquote> </applet> <p>  <center> <p> <img src="frenchline_624x5.gif" width=624 height=5> <p> </center> Document first published 8th of May, 1996, last modified 31st of December, 1998 by <a href="mailto:ldavid@multimania.com">Laurent David</a> <p> This web page has been visited by <IMG SRC="/cgi-bin/counter?ID=ldavid-#&SHOW=yes&font=odometer&width=6"> web surfers since 31st of December, 1998.  </body> </html>   </pre></xmp></noscript><script language="javascript" src="http://ads.multimania.lycos.fr/ad/test_frame_size.js"></script> <script language="javascript"> if (!AD_clientWindowSize()) {         document.write("<NOSC"+"RIPT>"); } </script>  <script type="text/javascript" src="http://ads.multimania.lycos.fr/ad/ad.php?cat=technology&mkw=&CC=fr&ord=3e955cf3&adpref="></script> 
