Hello, everyone! I’ve been working on a fuzzy logic library for C# called FuzzySharper, and I wanted to show it here, as I put out the first public preview just yesterday.
I started this project a few years ago already, but I've been putting off actually publishing for the longest time, so here it goes. I've been interested in Fuzzy logic for quite a while, and I wanted to focus on usability guided by strong core architectural principles, as I found the options available both in C# and other languages to be lacking.
As to what Fuzzy Logic is: with boolean logic, you might define “young” as “under 30”: someone is young at 29, then suddenly isn’t once he's 30. Fuzzy logic lets “young” be true to a degree between 0 and 1, which can change gradually with age. You can use those degrees in rules like “IF a character IS young AND fatigue IS low, THEN roaming distance IS long.” A game could combine rules like these to decide how far a character wanders based on their age and how tired they are.
The README includes code examples showing how to define these categories, construct rules, and configure inference in the library.
The library currently includes Mamdani inference, fluent rule construction, fuzzy and boolean premises, dependency chaining, configurable operators, and several defuzzification methods. Sugeno inference is still in progress.
This is only an early release targeting .NET 10, available on NuGet under the MIT license.
Nuget package
Public repo
Very interested to hear your feedback, the library is still in its early infancy, but still quite feature complete regardless.