Good old Game of Life, which will be the basis of multiplying rabbits in this game
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Entities Entity
GameOfDeath GameOfDeath
GameOfDeath RabbitGrid
Namespace: GameOfDeath
Assembly: GameOfDeath (in GameOfDeath.exe) Version: 1.1.1.0 (1.1.1)
Syntax
The GameOfDeath type exposes the following members.
Constructors
Name | Description | |
---|---|---|
GameOfDeath | Initializes a new instance of the GameOfDeath class |
Methods
Name | Description | |
---|---|---|
Add T | (Inherited from Entity.) | |
AddTag | (Inherited from Entity.) | |
BaseUpdate | ||
ClearTags | (Inherited from Entity.) | |
Contains T | (Inherited from Entity.) | |
ContainsBehavior T | (Inherited from Entity.) | |
ContainsTag | (Inherited from Entity.) | |
Deactivate | (Inherited from Entity.) | |
Dispose | (Inherited from Entity.) | |
Get T |
Gets a specific component, derived classes can return faster cached values (e.g. Entity2D)
View code on GitHub (Inherited from Entity.) | |
GetActiveBehaviors | (Inherited from Entity.) | |
GetComponentsForSaving | (Inherited from Entity.) | |
GetNumberOfNeighbours | ||
GetOrDefault T | (Inherited from Entity.) | |
GetTags | (Inherited from Entity.) | |
Randomize | ||
Remove T | (Inherited from Entity.) | |
RemoveTag | (Inherited from Entity.) | |
Set | (Inherited from Entity.) | |
SetComponents | (Inherited from Entity.) | |
ShouldSurvive | ||
Start T | (Inherited from Entity.) | |
Stop T | (Inherited from Entity.) | |
ToString | (Inherited from Entity.) | |
Update |
Fields
Name | Description | |
---|---|---|
components | (Inherited from Entity.) | |
CurrentWorld | ||
height | ||
NextGeneration | ||
width |
Properties
Name | Description | |
---|---|---|
GenerationCount | ||
IsActive | (Inherited from Entity.) | |
IsPauseable | (Overrides Entity IsPauseable.) | |
Item | ||
MatrixSize | ||
NumberOfComponents | (Inherited from Entity.) | |
UpdatePriority | (Inherited from Entity.) |
Remarks
Examples
[Test] public void CreateSimplestGameOfLifeEverWith1X1() { game = new GameOfDeath(1, 1); Assert.AreEqual(0, game.GenerationCount); game.Update(); Assert.AreEqual(1, game.GenerationCount); }
[Test] public void CreateInvalidGameOfLife() { Assert.Throws<GameOfDeath.SizeMustBeGreaterThanZero>(() => new GameOfDeath(0, 0)); }
[Test] public void OneCellShouldDisappearAfterOneIteration() { game = new GameOfDeath(3, 3); game[1, 1] = true; game.Update(); Assert.IsFalse(game[1, 1]); }
See Also