ConwaysGameOfLife 1.0.2
See the version list below for details.
dotnet add package ConwaysGameOfLife --version 1.0.2
NuGet\Install-Package ConwaysGameOfLife -Version 1.0.2
<PackageReference Include="ConwaysGameOfLife" Version="1.0.2" />
paket add ConwaysGameOfLife --version 1.0.2
#r "nuget: ConwaysGameOfLife, 1.0.2"
// 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 | Versions 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. |
-
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.
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.