OnePage

Game of Life, Redo

Prabhaker Mateti

Wright State University

www.cs.wright.edu/~pmateti

1 Conway's Game of Life

  1. Any live cell with
    1. < 2 live neighbours dies (as if caused by under-population).
    2. 2 or 3 live neighbours lives on to the next generation.
    3. > 3 live neighbours dies (as if by over-population).
  2. Any dead cell with exactly three live neighbours becomes a live cell (as if by reproduction).
  3. https://en.wikipedia.org/wiki/Conway's_Game_of_Life

1.1 GUI Needs of GoL

  1. A (stationary) grid of cells; infinite in x and y axes
  2. Draw/Erase a cell; filled? color?
  3. Control: speed, size, …
  4. Themes: colrrs, circle, square, …
  5. Kbd/Mouse/Touch interface
  6. Extensible (plugins)

1.2 Observations

  1. Inherently concurrent
  2. Systolic (as in heart beat)
  3. Non-Trivial: Correct implementation of the rules
  4. Non-Trivial: Infinite grid
  5. Non-Trivial: Detecting rule applicability

2 Open Source GoL Implementations

2.1 Edwin Martin's Implementation

  1. http://www.bitstorm.org/gameoflife/code
  2. Doxygen of Game-Of-Life
  3. A quick tour
  4. Uses Java JDK 1.1
  5. import java.awt.*

2.2 Other Implementations

  1. https://github.com/Dricus/game-of-life "A small practice project for doing Test Driven Development and doing basic 2D stuff with JavaFX." Java, JavaFX and XML; Open Source Code, 2014
  2. http://pmav.eu/stuff/javascript-game-of-life-v3.1.1/ Javascript, Canvas
  3. https://www.youtube.com/watch?v=Ti8cXWvclKo&list by "ForseenParadox"; cliams to have programmed in 1 hour while video recording
  4. Google Play for Android has several APKs. Probably not open source.

3 Game of Life Redo

  1. Re-write/ Refactor/ Annotate/ Document GoL
  2. Concurrent design and implementation
  3. Event driven design and implementation
  4. Wiki has several patterns – all these must "work"
  5. Tabs, one GoL running in each
  6. Look elegant
  7. A portion of the above is Lab L2

4 Choose a GUI Framework

  1. There are several to choose from. Listed below a few.
  2. We only need 2D
  3. Size of the resulting program.
  4. Here is an example QA: https://www.quora.com/With-which-should-I-start-developing-games-libGDX-framework-or-Unity3D

4.1 Swing

  1. Extract from http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6
  2. Is JavaFX replacing Swing as the new client UI library for Java SE?
  3. Yes. However, Swing will remain part of the Java SE specification for the foreseeable future, and therefore included in the JRE. While we recommend developers to leverage JavaFX APIs as much as possible when building new applications, it is possible to extend a Swing application with JavaFX, allowing for a smoother transition.

4.2 JavaFX

  1. Ensemble "provides a gallery of over 100 sample applications that use a wide range of JavaFX features, such as graphics, UI controls, animation, charts, media and WebView. Source code for each sample and links to API documentation are also provided. Ensemble will provide developers with an interactive reference tool for what they can build with JavaFX."
  2. http://www.oracle.com/technetwork/java/javase/overview/javafx-samples-2158687.html

4.3 DukeScript

  1. "Create cross-platform mobile and desktop applications with Java and HTML5. Unlike other solutions which make use of Java on the server side, DukeScript uses Java on the client side without relying on Oracle’s plug-in used in the past to run applets."
  2. "The technology runs on Android, iOS, desktop browsers, and any HTML5/JavaScript environment."
  3. http://dukescript.com/

4.4 LibGDX

  1. Free and Open Source, Java
  2. HTML and CSS
  3. Ingress, Apparatus were developed on libGDX.
  4. "Publish your games on Windows, Mac, Linux, Android, iOS, BlackBerry and HTML5, all with the same code base."
  5. https://libgdx.badlogicgames.com/

4.5 Unity

  1. Game engine.
    1. Displaying, and animating objects
    2. Physics modeling: Collision detection
    3. GUI
    4. Artificial Intelligence
  2. Not open source, not free, but has a free version.
  3. Monument Valley, Temple Run 2, Angry Birds Epic were developed on Unity.
  4. http://unity3d.com/

Copyright © 2015 www.wright.edu/~pmateti