The very core of the code can be found here
Installation instructions here
Tests are done on the following patterns:
Blinker oscillator | Toad oscillator |
---|---|
Period = 2 | Period = 2 |
A Scala.js implementation of Conway's Game of Life, a cellular automaton devised in 1970 by the British mathematician John Horton Conway. It is considered a zero-player or solitaire game because its evolution is determined by its initial state, requiring no further input from humans.
It is the best-known example of a cellular automaton and probably the most often programmed computer game in existence.
A Conway grid is infinite two-dimensional orthogonal. In fact, Conway's Game of Life is Turing complete, so this implementation avoids using fixed-size structures such as arrays. Instead, each generation is represented by a set of the "alive" cells. So the presence of a coordinate in a set will signal the fact of a living cell.
This solution is programmed with best practice and the pragmatics of functional programming in Scala with its idiomatics.
- Clone the Github project to a new directory. This is the project directory which becomes the working directory of the current folder.
- Naturally, at least a Java SE Runtime Environment (JRE) is installed on your platform and has a path to it enables execution.
- (Optional) Test this by submitting a
java -version
command in a Command Line Interface (CLI, terminal). The output should look like this:
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
- Make sure sbt is runnable from almost any work directory, use eventually one of the platform depended installers:
- Installing sbt on Mac or
- Installing sbt on Windows or
- Installing sbt on Linux or
- Manual installation (not recommended)
- (Optional ) To test if sbt is effective submit the
sbt sbtVersion
command. The response could (after 50 notices of downloading) look like as this:
[info] Set current project to fransdev (in build file:/C:/Users/FransDev/)
[info] 0.13.13
Remember shells (CLI's) are not reactive. To pick up the new environment variables the CLI must be closed and restarted.
- Run sbt in one of the next modes in a CLI in the working directory or current folder, a compilation will be started and a local web server will be spun up using:
- Inline mode on the command line:
sbt fastOptJS
or - Interactive mode, start first the sbt by hitting in the CLI
sbt
followed byfastOptJS
on the sbt prompt, or - Triggered execution by a
~
before the command, so~fastOptJS
. This command will execute and wait after the target code is in time behind the source code (Auto build). chrome:test
will run the ScalaTest test scripts in the test directory in a Google Chrome browser.firefox:test
will start the ScalaTest test scripts in the test directory in a FireFox browser. (Preferred)
- Inline mode on the command line:
- sbt will give a notice that the server is listening by the message:
Bound to localhost/127.0.0.1:12345
(Ignore the dead letter notifications with the enter key.) - Open this application in a browser with this given URL
When running this way a tool "workbench" also will be running in the browser, noticeable by opening the console of the browser.