ConwaysGameOfLife 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package ConwaysGameOfLife --version 1.0.2                
NuGet\Install-Package ConwaysGameOfLife -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ConwaysGameOfLife" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ConwaysGameOfLife --version 1.0.2                
#r "nuget: ConwaysGameOfLife, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ConwaysGameOfLife as a Cake Addin
#addin nuget:?package=ConwaysGameOfLife&version=1.0.2

// Install ConwaysGameOfLife as a Cake Tool
#tool nuget:?package=ConwaysGameOfLife&version=1.0.2                

Conway's Game of Life Library

This is a C# .NET 6 library that implements Conway's Game of Life. It allows users to create a game instance, set initial states of cells, and iterate through generations.

Installation

Clone the repository or download the source code and add it to your project as a reference.

Usage

First, create a GameOfLifeBuilder instance to set up the game parameters, such as width, height, and game mode. Then, use the builder to create a new instance of the game.

bool[,] initialBoard =
{
    { false, false, false },
    { false, true , false},
    { false, false, false }
};

GameOfLifeBase game = new GameOfLifeBuilder()
                      .SetAsClassicGameOfLife()
                      .SetWidth(3)
                      .SetHeight(3)
                      .SetInitialGeneration(initialBoard)
                      .Build()

To iterate through generations, call the NextGeneration() method.

game.NextGeneration();

To get the current state of the board, call the GetCurrentBoard() method. To get the state of a specific cell, call the GetCell(int x, int y) method.

bool[,] currentBoard = game.GetCurrentBoard();
bool isCellAlive = game.GetCell(1, 1);

To set the state of a specific cell, call the SetCell(int x, int y, bool isAlive) method.

game.SetCell(1, 1, true);

Testing

The library comes with a set of unit tests to ensure the correctness of its implementation. Tests can be found in the ConwaysGameOfLifeTests directory.

Contributing

Contributions to this library are welcome. Please submit a pull request with your changes.

License

This library is licensed under the MIT License. See the LICENSE file for more information.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.2 181 4/25/2023
1.0.2 156 4/25/2023
1.0.1 164 4/23/2023
1.0.0 181 4/23/2023

Removed the DotnetTool package type from the library, to ensure compatibility with projects that don't support it.
Note: This change was made to address compatibility issues with the 'ConsoleGameOfLife' project.