Giter VIP home page Giter VIP logo

gameoflife's Introduction

Game of Life ci

This is my implementation of Conway's Game of Life.

Building

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.

Controls

  • Q: quit
  • W: move screen up
  • S: move screen down
  • A: move screen left
  • D: 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

Config file

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"
    ]
}

gameoflife's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.