Antzy21.Games.Checkerboard
5.0.0
dotnet add package Antzy21.Games.Checkerboard --version 5.0.0
NuGet\Install-Package Antzy21.Games.Checkerboard -Version 5.0.0
<PackageReference Include="Antzy21.Games.Checkerboard" Version="5.0.0" />
paket add Antzy21.Games.Checkerboard --version 5.0.0
#r "nuget: Antzy21.Games.Checkerboard, 5.0.0"
// Install Antzy21.Games.Checkerboard as a Cake Addin #addin nuget:?package=Antzy21.Games.Checkerboard&version=5.0.0 // Install Antzy21.Games.Checkerboard as a Cake Tool #tool nuget:?package=Antzy21.Games.Checkerboard&version=5.0.0
Checkerboard 5.0
This library is for efficient storing of creating, modifying and accessing a checkerboard. A checkerboard is an 8x8 board of squares used in games such as Chess and Checkers. Checkerboard is implemented functionally using F#. The library mainly comprises two modules: Coordinates
and BitMap
, each with their associated functions.
Types and Modules
Coordinates
The coordinates
type plays a vital role within the library, represented as a UInt64
. It mainly deals with the creation, manipulation, and extraction of checkerboard square coordinates.
Module Functions:
construct
: Constructs acoordinates
instance from given row and column values, represented as integers.getFile
: Returns the file (column) of thecoordinates
instance as a numeric value, based at 0.getFileLetter
: Returns the file (column) of any givencoordinates
type as an alphanumeric character.getRow
: Returns the row of thecoordinates
instance as a numeric value, based at 0.getRowNumber
: Returns the row of thecoordinates
instance as a string value, based at 1.getName
: Returns the name of thecoordinates
instance as a string, which is the combination of its file and row.parse
: Takes a string representation of a coordinate (in "[file][row]" format, e.g., "a2") and transforms it into acoordinates
instance.
BitMap
The bitMap
type, essentially a UInt64
, represents checkerboard states effectively. A checkerboard layer composed of multiple bitMaps
can denote custom square states over an 8x8 board.
Module Functions:
getValueAtCoordinates (c: coordinates) (bitMap: bitMap)
: Get the bit value at a specific coordinate from the provided bitmap.setValueAtCoordinates (value: bool) (c: coordinates) (bitMap: bitMap)
: Sets the designated value at a specific coordinate in the provided bitmap.switchValueAtCoordinates (c: coordinates) (bitMap: bitMap)
: Switches the bit value at a specific coordinate.isolateValues (bitMap: bitMap)
: Isolates the coordinates of positive values in bitmap format. Returns a list ofbitMaps
where each has a single bit in common with the given bitmap.
CoordinatesCollection Module
The CoordinatesCollection
type manages collections of Coordinates
instances. Each CoordinatesCollection
is a UInt64
under the hood, which serves as a compact way to store multiple coordinates at once.
Module Functions
construct
: Constructs an emptycoordinatesCollection
.toList
: Converts acoordinatesCollection
into a List ofcoordinates
.append
: Adds acoordinates
instance to acoordinatesCollection
.appendResult
: Tries to append acoordinates result
value to acoordinatesCollection
. Ifcoordinates result
is an error, this function ignores it and returns thecoordinatesCollection
as-is.remove
: Deletes acoordinates
instance from acoordinatesCollection
.filter
: Filters acoordinatesCollection
, such that only coordinates that also exist in a provided maskCoordinatesCollection
remain in the output.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Antzy21.FSharp.Extensions (>= 1.1.4)
- FSharp.Core (>= 8.0.100)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Upgrade to .net 8. Major restructure of Coordinates type.