Skip to content

Commit

Permalink
adding more applets, game of life, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
berlinbrown committed Dec 29, 2011
1 parent dc7c43d commit 5d7b86c
Show file tree
Hide file tree
Showing 189 changed files with 46,813 additions and 0 deletions.
11 changes: 11 additions & 0 deletions applets/scala/GameOfLifeCellular/.classpath
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/scala"/>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/unmanaged/log4j-1.2.16.jar"/>
<classpathentry kind="lib" path="lib/unmanaged/slf4j-log4j12-1.6.1.jar"/>
<classpathentry kind="lib" path="lib/unmanaged/slf4j-api-1.6.1.jar"/>
<classpathentry kind="output" path="src/main/webapp/WEB-INF/classes"/>
</classpath>
30 changes: 30 additions & 0 deletions applets/scala/GameOfLifeCellular/.project
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>GameOfLife</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>net.sourceforge.texlipse.builder.TexlipseBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.scala-ide.sdt.core.scalabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>ch.epfl.lamp.sdt.core.scalabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>net.sourceforge.texlipse.builder.TexlipseNature</nature>
<nature>ch.epfl.lamp.sdt.core.scalanature</nature>
<nature>org.scala-ide.sdt.core.scalanature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
386 changes: 386 additions & 0 deletions applets/scala/GameOfLifeCellular/.scala_dependencies

Large diffs are not rendered by default.

118 changes: 118 additions & 0 deletions applets/scala/GameOfLifeCellular/README.txt
@@ -0,0 +1,118 @@
###########################################################
# README
# Created: 1/11/2011
###########################################################

About: BottomUpCellLifeGame
-----------------------------

Also see:

http://doingitwrongnotebook.googlecode.com/svn/trunk/doingitwrong_phase2/scala2/GameOfLife/src/main/scala/
http://code.google.com/p/ainotebook/wiki/BottomUpArtificialLifeSimulation

-----
Notes:
-----

- The system is slightly interesting. You can monitor the balance with the number of live cells.
You may notice a shift in mutations as cells grow away from the center.

- With only a few mutations, the color of cells tend to shift in color over time.

- It takes many iterations for emergent behavior to emerge.

- Code wise not really that interesting but already we can visualize the emergent behavior.

- Cheating to make the simulation feasible

-----
Building:
-----
Artificial Life Demo - launch the sbt.bat script and type compile at the prompt
- sbt - at prompt compile
- sbt - at prompt package
- sbt - at prompt package-src


-----
Now Using:
-----
Scala Version: Scala 2.9.0 r24613 b20110328152330

Previously Using scala: 2.8.0.r22118-b20106020


sbt - simple build tool
-----

Simple game of life in Scala and using scala.swing api.
Doing it wrong version, no refactoring.

Keywords: rule30, rule190, squaringrule, wolfram

-----
Running:
-----
Run the applet[1-4].html files in a modern browser. The java applets will execute.

-----
Adding svn propset on html files.
svn propset svn:mime-type 'text/html' applet.html
-----

Berlin Brown - berlin dot brown _at_ gmail dot com
keywords: cells, dna, replication, gameoflife, scala, java, alife, artificiallife

---------------------------------------

The field of artificial intelligence in computer science focuses on many
different areas of computing from computer vision to natural language
processing. These top-down approaches typically concentrate on human behavior
or other animal functions. In this article we look at a bottom-up approach to
artificial life and how emergent cell behavior can produce interesting results.
With this bottom-up alife approach, we are not interested in solving any
particular task, but we are interested in observing the adaptive nature of the
entities in our simulation. We also wanted to introduce those more familiar with
software engineering to biological systems and evolutionary theory concepts.

Life is all around us. Even with inorganic material it is possible that
microscopic organisms are covering that surface. Moving forward if we want to
study, analyze and work with artificial agents, we might consider systems that
have evolved behavior over a series of steps. We should not necessarily build a
specific tool with a specific purpose but the creature that is built from the
system may produce interesting properties which are unlike the clean-room
created software that we create today. Most software and hardware today is
written to specification, line for line, most code written for today's systems
are created by man. That software is designed, coded and tested. It would be
interesting if we could start a biological like system and interesting behavior
from the system evolves over time.

Conway's Game of Life cellular automaton is one of the most prominent examples
of cellular automata theory. The one dimensional program consists of a cell grid
typically with several dozen or more rows and similar number of columns. Each
cell on the grid has an on or off Boolean state. Every cell on the grid survives
or dies to the next generation depending on the game of life rules. If there are
too many neighbors surrounding a cell then the cell dies due to overcrowding. If
there is only one neighbor cell, the base cell dies due to under-population.
Activity on a particular cell is not interesting but when you run the entire
system for many generations, a group of patterns begin to form.

You may notice some common patterns in the figure. After so many iterations
through the game of life rules, only a few cells tend to stay alive. We started
with a large random number of alive cells and over time those cells died off. In
a controlled environment you may begin with carefully placed live cells and
monitor the patterns that emerge to model some other natural phenomena.

Summary

Moving forward if we want to study, analyze and work with artificial agents, we
might consider systems that have evolved behavior over a series of steps. We
might not build a specific tool with a specific purpose but the creature that is
built from the system may produce interesting properties which are unlike the
clean-room created software that we create today.

With this artificial life approach, but we also want to study the simple life
forms first before moving too fast forward like human behavior.

-- Berlin Brown
8 changes: 8 additions & 0 deletions applets/scala/GameOfLifeCellular/TODO
@@ -0,0 +1,8 @@
###########################################################
# TODO
###########################################################

For bottom up alife sim:

- Add simple charts

21 changes: 21 additions & 0 deletions applets/scala/GameOfLifeCellular/_applet3.html
@@ -0,0 +1,21 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Applet Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script src="deployJava.js"></script>
</head>
<body>
<h3>Cellular Automata Game of Life Applet</h3>

<script>
var attributes = {
code: 'org.berlin.gol.sound.GameOfLifeSoundApplet',
archive: 'scala-library.jar,scala-swing.jar,gameoflifesound.jar',
width:400, height:400
};
var parameters = { };
deployJava.runApplet(attributes, parameters, '1.6');
</script>
</body>
</html>
2 changes: 2 additions & 0 deletions applets/scala/GameOfLifeCellular/alife.bat
@@ -0,0 +1,2 @@
set SCRIPT_DIR=%~dp0
java -Xmx300M -classpath "%SCRIPT_DIR%;slf4j-api-1.6.1.jar;%SCRIPT_DIR%slf4j-log4j12-1.6.1.jar;%SCRIPT_DIR%log4j-1.2.16.jar;%SCRIPT_DIR%scala-swing.jar;%SCRIPT_DIR%scala-library.jar;%SCRIPT_DIR%alife_2.8.0-1.0.jar" org.berlin2.bottomuplife.CellSimulation
53 changes: 53 additions & 0 deletions applets/scala/GameOfLifeCellular/applet.html
@@ -0,0 +1,53 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Applet Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script src="deployJava.js"></script>
</head>
<body>
<h1>Game of Life Applet</h1>

<p>
Conway's Game of Life cellular automaton is one of the most prominent examples of cellular automata theory.
The one dimensional program consists of a cell grid typically with several dozen or more rows and similar
number of columns. Each cell on the grid has an on or off Boolean state. Every cell on the grid survives or dies
to the next generation depending on the game of life rules. If there are too many neighbors surrounding a
cell then the cell dies due to overcrowding. If there is only one neighbor cell,
the base cell dies due to under-population. Activity on a particular cell is not interesting
but when you run the entire system for many generations, a group of patterns begin to form.

<br /> <br />

Stephan Wolfram is the founder of Wolfram|Research, his company is known for the popular Mathematica software suite
and Wolfram|Alpha knowledge engine. He did not initially discover cellular automata but recently
he has been a prominent figure in its advocacy. He spent 10 years working on his book, A New Kind of Science.
In the 1300 page tome, he discusses how cellular automata can be applied to every field of science from biology to physics.
NKA is a detailed study of cellular automata programs.

<br /> <br />

Cellular automata is often used with data compression, cryptography, artificial intelligence, urban planning,
financial market modeling, music generation, and 3D terrain generation. If you are a software engineer,
you may have to step back and consider how cellular automata patterns emerge and understand the nature of
the dynamic system before looking for a typical software library. CA is not normally seen in everyday applications.
Consider this when you look at some random pattern, don't think of the phenomenon as a random sequence of events that
cannot be replicated, think of the event in terms of a cellular automaton. Try to imagine the rules that could
model that natural behavior. Modeling seemingly random patterns is an area where cellular automata is being widely used. Urban planning departments are integrating geographic information systems (GIS)
with cellular automata in an attempt to predict growth in an area of a city.
</p>

Example automata applet in Scala: -- Berlin Brown
<br />

<script>
var attributes = {
code: 'org.berlin.gol.GameOfLifeApplet',
archive: 'gameoflife.jar',
width:600, height:600
};
var parameters = { };
deployJava.runApplet(attributes, parameters, '1.6');
</script>
</body>
</html>
52 changes: 52 additions & 0 deletions applets/scala/GameOfLifeCellular/applet2.html
@@ -0,0 +1,52 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Applet Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script src="deployJava.js"></script>
</head>
<body>
<h3>Basic Wolfram Cellular Automata Applet</h3>

<p>
Conway's Game of Life cellular automaton is one of the most prominent examples of cellular automata theory.
The one dimensional program consists of a cell grid typically with several dozen or more rows and similar
number of columns. Each cell on the grid has an on or off Boolean state. Every cell on the grid survives or dies
to the next generation depending on the game of life rules. If there are too many neighbors surrounding a
cell then the cell dies due to overcrowding. If there is only one neighbor cell,
the base cell dies due to under-population. Activity on a particular cell is not interesting
but when you run the entire system for many generations, a group of patterns begin to form.

<br /> <br />

Stephan Wolfram is the founder of Wolfram|Research, his company is known for the popular Mathematica software suite
and Wolfram|Alpha knowledge engine. He did not initially discover cellular automata but recently
he has been a prominent figure in its advocacy. He spent 10 years working on his book, A New Kind of Science.
In the 1300 page tome, he discusses how cellular automata can be applied to every field of science from biology to physics.
NKA is a detailed study of cellular automata programs.

<br /> <br />

Cellular automata is often used with data compression, cryptography, artificial intelligence, urban planning,
financial market modeling, music generation, and 3D terrain generation. If you are a software engineer,
you may have to step back and consider how cellular automata patterns emerge and understand the nature of
the dynamic system before looking for a typical software library. CA is not normally seen in everyday applications.
Consider this when you look at some random pattern, don't think of the phenomenon as a random sequence of events that
cannot be replicated, think of the event in terms of a cellular automaton. Try to imagine the rules that could
model that natural behavior. Modeling seemingly random patterns is an area where cellular automata is being widely used. Urban planning departments are integrating geographic information systems (GIS)
with cellular automata in an attempt to predict growth in an area of a city.
</p>

Example automata applet in Scala: -- Berlin Brown
<br />
<script>
var attributes = {
code: 'org.berlin.automata.AutomataApplet',
archive: 'scala-library.jar,scala-swing.jar,automatascala.jar',
width:1000, height:1000
};
var parameters = { };
deployJava.runApplet(attributes, parameters, '1.6');
</script>
</body>
</html>
52 changes: 52 additions & 0 deletions applets/scala/GameOfLifeCellular/applet4.html
@@ -0,0 +1,52 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Applet Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script src="deployJava.js"></script>
</head>
<body>
<h3>Cellular Squaring Automata Applet</h3>

<p>
Conway's Game of Life cellular automaton is one of the most prominent examples of cellular automata theory.
The one dimensional program consists of a cell grid typically with several dozen or more rows and similar
number of columns. Each cell on the grid has an on or off Boolean state. Every cell on the grid survives or dies
to the next generation depending on the game of life rules. If there are too many neighbors surrounding a
cell then the cell dies due to overcrowding. If there is only one neighbor cell,
the base cell dies due to under-population. Activity on a particular cell is not interesting
but when you run the entire system for many generations, a group of patterns begin to form.

<br /> <br />

Stephan Wolfram is the founder of Wolfram|Research, his company is known for the popular Mathematica software suite
and Wolfram|Alpha knowledge engine. He did not initially discover cellular automata but recently
he has been a prominent figure in its advocacy. He spent 10 years working on his book, A New Kind of Science.
In the 1300 page tome, he discusses how cellular automata can be applied to every field of science from biology to physics.
NKA is a detailed study of cellular automata programs.

<br /> <br />

Cellular automata is often used with data compression, cryptography, artificial intelligence, urban planning,
financial market modeling, music generation, and 3D terrain generation. If you are a software engineer,
you may have to step back and consider how cellular automata patterns emerge and understand the nature of
the dynamic system before looking for a typical software library. CA is not normally seen in everyday applications.
Consider this when you look at some random pattern, don't think of the phenomenon as a random sequence of events that
cannot be replicated, think of the event in terms of a cellular automaton. Try to imagine the rules that could
model that natural behavior. Modeling seemingly random patterns is an area where cellular automata is being widely used. Urban planning departments are integrating geographic information systems (GIS)
with cellular automata in an attempt to predict growth in an area of a city.
</p>

Example automata applet in Scala: -- Berlin Brown
<br />
<script>
var attributes = {
code: 'org.berlin.automata.squaring.CellularAutomataSquareApplet',
archive: 'scala-library.jar,scala-swing.jar,squaringautomata.jar',
width:700, height:700
};
var parameters = { };
deployJava.runApplet(attributes, parameters, '1.6');
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions applets/scala/GameOfLifeCellular/applet_gadget.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="remote content example" />
<Content type="url" href="http://doingitwrongnotebook.googlecode.com/svn/trunk/doingitwrong_phase2/scala2/GameOfLife/applet.html" />
</Module>
5 changes: 5 additions & 0 deletions applets/scala/GameOfLifeCellular/applet_gadget2.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="remote content example" />
<Content type="url" href="http://doingitwrongnotebook.googlecode.com/svn/trunk/doingitwrong_phase2/scala2/GameOfLife/applet2.html" />
</Module>
5 changes: 5 additions & 0 deletions applets/scala/GameOfLifeCellular/applet_gadget3.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="remote content example" />
<Content type="url" href="http://doingitwrongnotebook.googlecode.com/svn/trunk/doingitwrong_phase2/scala2/GameOfLife/applet3.html" />
</Module>
5 changes: 5 additions & 0 deletions applets/scala/GameOfLifeCellular/applet_gadget4.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="remote content example" />
<Content type="url" href="http://doingitwrongnotebook.googlecode.com/svn/trunk/doingitwrong_phase2/scala2/GameOfLife/applet4.html" />
</Module>
Binary file not shown.
7 changes: 7 additions & 0 deletions applets/scala/GameOfLifeCellular/branch.sh
@@ -0,0 +1,7 @@
#!/bin/sh

svn copy \
https://doingitwrongnotebook.googlecode.com/svn/trunk/doingitwrong_phase2/scala2/GameOfLife \
https://doingitwrongnotebook.googlecode.com/svn/branches/ainotebookBottomUpInitRelease/doingitwrong_phase2/scala2/GameOfLife \
-m 'creating branch'

0 comments on commit 5d7b86c

Please sign in to comment.