This is my implementation of Conway's Game of Life.
On any Unix-like platform, run dotnet build
in the source directory with .NET Core to build.
On Windows, open GameOfLife.sln
in Visual Studio and hit Ctrl+Shift+B
to build.
Q
: quitW
: move screen upS
: move screen downA
: move screen leftD
: move screen right-
: zoom out/enlarge console=
/+
: zoom in/shrink console (I couldn't make the font smaller)- Up arrow: increase framerate
- Down arrow: decrease framerate
- Left arrow: go back a frame
- Right arrow: go forward a frame
- Space bar: pause/resume
To specify a starting position among other things, create a config.json
file in the executable's working directory. This will let you load a state on startup. For example, to create a beehive:
{
"InitialState": [
[ 0, 1 ],
[ 3, 1 ],
[ 1, 0 ],
[ 2, 0 ],
[ 1, 2 ],
[ 2, 2 ]
]
}
It's also possible to create custom rules. To create a custom rule, create a .NET assembly linked against GameOfLife.dll
with a class like so:
using GameOfLife;
namespace MyRuleset
{
public class MyCustomRuleContainerClass
{
// the method must be static AND public
[CustomRule]
public static MyCustomRule(BoardController controller, Vector cell)
{
// rule code goes here
}
}
}
Then, to apply your rule to the game, insert an entry into RulesetAssemblies
like specified below:
{
"InitialState": [
...
],
"RulesetAssemblies": [
"MyRuleset.dll"
]
}