GameOfLife ClassDelta Engine Documentation
Implement Conway's Game of Life: http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life#Rules View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Entities Entity
    DeltaEngine.Entities DrawableEntity
      DeltaEngine.Rendering2D Entity2D
        GameOfLife GameOfLife

Namespace: GameOfLife
Assembly: GameOfLife (in GameOfLife.exe) Version: 1.1.1.0 (1.1.1)
Syntax

public class GameOfLife : Entity2D, Updateable

The GameOfLife type exposes the following members.

Constructors

  NameDescription
Public methodGameOfLife
Initializes a new instance of the GameOfLife class
Top
Methods

  NameDescription
Public methodAdd T  (Inherited from Entity2D.)
Public methodAddTag (Inherited from Entity.)
Public methodBatchReviveCells
Public methodClearTags (Inherited from Entity.)
Public methodContains T  (Inherited from Entity2D.)
Public methodContainsBehavior T  (Inherited from Entity.)
Public methodContainsTag (Inherited from Entity.)
Protected methodDeactivate (Inherited from Entity.)
Public methodDispose
Releases all resources used by the GameOfLife
(Overrides Entity Dispose .)
Public methodGet T  (Inherited from Entity2D.)
Protected methodGetActiveBehaviors (Inherited from Entity.)
Public methodGetComponentsForEditing (Inherited from Entity2D.)
Protected methodGetComponentsForSaving (Inherited from Entity2D.)
Protected methodGetDrawBehaviors (Inherited from DrawableEntity.)
Public methodGetInterpolatedArray T  (Inherited from DrawableEntity.)
Public methodGetInterpolatedList T  (Inherited from DrawableEntity.)
Public methodGetOrDefault T  (Inherited from Entity.)
Public methodGetTags (Inherited from Entity.)
Public methodKillCellAtPosition
Protected methodNextUpdateStarted (Inherited from Entity2D.)
Public methodOnDraw T  (Inherited from DrawableEntity.)
Protected methodOnPositionChanged (Inherited from Entity2D.)
Protected methodOnRotationChanged (Inherited from Entity2D.)
Public methodRemove T  (Inherited from Entity.)
Public methodRemoveTag (Inherited from Entity.)
Public methodResetGameState
Public methodReviveCellAtPosition
Public methodRotatedDrawAreaContains (Inherited from Entity2D.)
Public methodSet (Inherited from Entity2D.)
Public methodSetComponents (Inherited from Entity.)
Public methodSetWithoutInterpolation T  (Inherited from Entity2D.)
Public methodSimulateNextGeneration
Runs a tick in the game word, apply the Game of Life rule to each cell in the grid View code on GitHub
Public methodStart T  (Inherited from Entity.)
Public methodStop T  (Inherited from Entity.)
Public methodToggleVisibility (Inherited from DrawableEntity.)
Public methodToString (Overrides Entity ToString .)
Public methodUpdate
Top
Extension Methods

  NameDescription
Public Extension MethodAffixToPhysics (Defined by Entity2DPhysicsExtensions.)
Public Extension MethodStartBouncingOffScreenEdges (Defined by Entity2DExtensions.)
Public Extension MethodStartFalling (Defined by Entity2DExtensions.)
Public Extension MethodStartMoving (Defined by Entity2DExtensions.)
Public Extension MethodStartRotating (Defined by Entity2DExtensions.)
Top
Fields

  NameDescription
Protected fieldcomponents (Inherited from Entity.)
Protected fieldlastTickLerpComponents
Each element can either be a Lerp, a Lerp List or an array of Lerp objects. View code on GitHub
(Inherited from DrawableEntity.)
Top
Properties

  NameDescription
Public propertyAlpha (Inherited from Entity2D.)
Public propertyCenter (Inherited from Entity2D.)
Public propertyColor (Inherited from Entity2D.)
Public propertyDidFootprintChange (Inherited from Entity2D.)
Public propertyDrawArea (Inherited from Entity2D.)
Public propertyGameGrid
Public propertyGeneration
Public propertyIsActive (Inherited from DrawableEntity.)
Public propertyIsPauseable (Inherited from Entity.)
Public propertyIsVisible (Inherited from DrawableEntity.)
Public propertyLastColor (Inherited from Entity2D.)
Public propertyLastDrawArea (Inherited from Entity2D.)
Public propertyNumberOfComponents (Inherited from Entity.)
Public propertyPopulation
Public propertyRenderLayer (Inherited from DrawableEntity.)
Public propertyRotation (Inherited from Entity2D.)
Public propertyRotationCenter (Inherited from Entity2D.)
Public propertySize (Inherited from Entity2D.)
Public propertyTopLeft (Inherited from Entity2D.)
Public propertyUpdatePriority (Inherited from Entity.)
Top
Remarks

Tests: GameOfLife.Tests.GameOfLifeTests
Examples

25 unit tests call GameOfLife.GameOfLife
[Test, CloseAfterFirstFrame]
public void GridShouldHaveRightSize()
{
    var gridSize = new Size(5);
    Assert.AreEqual(gridSize, gameOfLife.GameGrid.Dimension);
}
[Test, CloseAfterFirstFrame]
public void NewCreatedGridShouldHaveJustDeadCells()
{
    Assert.AreEqual(0, gameOfLife.Population);
}
[Test, CloseAfterFirstFrame]
public void RunningSimulationIncrementsGenerationByOne()
{
    Assert.AreEqual(0, gameOfLife.Generation);
    gameOfLife.SimulateNextGeneration();
    Assert.AreEqual(1, gameOfLife.Generation);
}
See Also