forked from beltoforion/Educational-Javascripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_of_life.html
64 lines (62 loc) · 3.61 KB
/
game_of_life.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script type="text/javascript" src="./javascript_samples/game_of_life/game_of_life.js"></script>
<link rel="stylesheet" type="text/css" href="./styles/index.css"/>
<link rel="stylesheet" type="text/css" href="./styles/article.css"/>
<style type="text/css">
canvas { border: 1px solid black; }
</style>
</head>
<body class="article">
<h2 class="article_caption">Example 2: Conveys Game of Life</h2>
<p>
This is the demonstration page of the "Game of Life" javascript applet. For more details about
the please turn to the <a href="http://articles.beltoforion.de/article.php?a=game_of_life" target="_blank">original game of life article.</a>
</p>
<table class="noborder">
<tr>
<td class="noborder"><canvas id="cvMain" width="800" height="600"/></td>
<td class="noborder">
<b>Select Pattern</b><br/>
<fieldset>
<input type="button" value="Randomize" onclick="cmd='random';" style="width:200px;height:40px;"/><br/>
<input type="button" value="R-pentomino (a Methuselah)" onclick="cmd='pat1';" style="width:200px;height:40px;"/><br/>
<input type="button" value="Glider" onclick="cmd='pat2';" style="width:200px;height:40px;"/><br/>
<input type="button" value="Spaceship" onclick="cmd='pat3';" style="width:200px;height:40px;"/><br/>
<input type="button" value="Trans Queen Bee Shuttle" onclick="cmd='pat4';" style="width:200px;height:40px;"/><br/>
<input type="button" value="Queen Bee Loop" onclick="cmd='pat5';" style="width:200px;height:40px;"/><br/>
<input type="button" value="Partial Queen Bee Loop" onclick="cmd='pat6';" style="width:200px;height:40px;"/><br/>
<input type="button" value="Tagalong for two LWSS" onclick="cmd='pat7';" style="width:200px;height:40px;"/><br/>
<input type="button" value="Glider Duplicator" onclick="cmd='pat8';" style="width:200px;height:40px;"/><br/>
<input type="button" value="Twogun" onclick="cmd='pat9';" style="width:200px;height:40px;"/><br/>
<input type="button" value="Newgun" onclick="cmd='pat10';" style="width:200px;height:40px;"/><br/>
<input type="button" value="Block-laying switch engine" onclick="cmd='pat11';" style="width:200px;height:40px;"/><br/>
<input type="button" value="40514M (a Methuselah)" onclick="cmd='pat12';" style="width:200px;height:40px;"/>
<p class="annotation" style="margin-top:10px; font-size:70%;">
(Patterns Courtesy of <a href="http://www.conwaylife.com/wiki/Main_Page">LifeWiki</a>)
</p>
</fieldset>
</td>
</tr>
<tr>
<td class="noborder">
<input type="button" value="Clear" onclick="cmd='clear';" style="width:100px; height:60px;"/>
<input type="button" value="Run / Cont." onclick="cmd='run';" style="width:100px; height:60px;"/>
<input type="button" value="Single Step" onclick="cmd='single';" style="width:100px; height:60px;"/>
<label style="width:100px; height:60px;"><input id="cbToroidal" type="checkbox" checked="true" onclick="cmd='update';"/>Toroidal World</label>
</td>
</tr>
</table>
<script>
game_of_life( { cvid : 'cvMain',
is_running : true,
is_torodial : true,
delay : 20,
cells_x : 200,
cells_y : 200 * 0.75 },
null );
</script>
</body>
</html>