Core_2048 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Core_2048 --version 1.0.0                
NuGet\Install-Package Core_2048 -Version 1.0.0                
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="Core_2048" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Core_2048 --version 1.0.0                
#r "nuget: Core_2048, 1.0.0"                
#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 Core_2048 as a Cake Addin
#addin nuget:?package=Core_2048&version=1.0.0

// Install Core_2048 as a Cake Tool
#tool nuget:?package=Core_2048&version=1.0.0                

2048

My take mini sdk libs for creating the 2048 game in C#. Suitable for any engine from console app to Unity game. Only 2048 game logic. A very simple customizable core for initialization game with params:

  • canvas size
  • base value, which means blank cells
  • configuring merging elements value
  • configuring predicate elements value
  • customizable amount of value for new cells with customizable chance of creation for each individual case
  • generic for the element value (Convenient for use in game engines)

Easy to implements in your game:

  1. Create a game board with height, width and initialized value
  2. Create a generator of random elements, set the check to an empty element and add a list of elements to the pool to generate with a specified percentage probability (Or you can create your own generator by implementing IElementGenerator)
  3. Create Core with board, baseValue, merge delegate, predictor, element generator
  4. Call AddNew for generating and add new element on board
  5. In the game loop, call the Update with arguments:
    • isAlongRow - true when movement left and right if render from up to down;
    • isIncreasing - true when movement left and up (if board render from up to down) or down (if board render from down to up);
  6. Add listeners on Updated action to see if cells moved after ant action.
  7. Call AddNew method when need add new value at board.
  8. Create Render method in your engine. In Core class has methods for base iteration and there is updating map with movement info for easier implementation of interaction with external object.

Sample console project in ConsoleOut directory.

Example code:

screenshot

Here's how it looks like:

screenshot

Also implementation in Unity:

screenshot

Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.7897.31647 882 8/15/2021
1.0.2 837 7/14/2021
1.0.1 859 6/5/2021
1.0.0 820 6/2/2021