All Projects → Aptacode → StateNet

Aptacode / StateNet

Licence: MIT License
A small .Net Standard library used to model simple State Machines

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to StateNet

AsteroidsWasm
Collection of applications based on a single C# .NET Standard project running in: Blazor Client (WebAssembly), Blazor Server, Electron, WPF, WinForms, Xamarin
Stars: ✭ 136 (+871.43%)
Mutual labels:  wpf, dotnet-standard
Csconsoleformat
.NET C# library for advanced formatting of console output [Apache]
Stars: ✭ 296 (+2014.29%)
Mutual labels:  wpf, dotnet-standard
cognite-sdk-dotnet
.NET SDK for Cognite Data Fusion (CDF)
Stars: ✭ 14 (+0%)
Mutual labels:  dotnet-standard
ember
@microstates/ember - Official Microstates bindings for Ember.js
Stars: ✭ 68 (+385.71%)
Mutual labels:  state-machines
NCalc2
GitHub clone of NCalc from http://ncalc.codeplex.com/
Stars: ✭ 97 (+592.86%)
Mutual labels:  dotnet-standard
GBCLV3
Goose Bomb's Minecraft Client Launcher
Stars: ✭ 50 (+257.14%)
Mutual labels:  wpf
pastebin-csharp
API client for Pastebin in C#
Stars: ✭ 25 (+78.57%)
Mutual labels:  dotnet-standard
arcgis-runtime-demos-dotnet
Demo applications provided by the ArcGIS Runtime SDK for .NET Team
Stars: ✭ 51 (+264.29%)
Mutual labels:  wpf
gelf-extensions-logging
GELF provider for Microsoft.Extensions.Logging
Stars: ✭ 81 (+478.57%)
Mutual labels:  dotnet-standard
MoYu
MoYu 一款能够帮助你在工作时摸鱼的欢乐软件
Stars: ✭ 14 (+0%)
Mutual labels:  wpf
Repository-Collection
A collection of useful Github repositories. Github项目精选。
Stars: ✭ 14 (+0%)
Mutual labels:  wpf
SocketHook
Socket hook is an injector based on EasyHook (win only) which redirect the traffic to your local server.
Stars: ✭ 38 (+171.43%)
Mutual labels:  wpf
RemoteFFmpegGUI
使用 Vue.js + ASP.NET 搭建的 FFMpeg 的 Web GUI 平台,支持视频转码、拼接视频、合并音视频等操作。并有使用 WPF 技术的 Windows 桌面端。
Stars: ✭ 21 (+50%)
Mutual labels:  wpf
H.NotifyIcon.WPF
NotifyIcon for .Net Core 3.1 and .Net 5 WPF.
Stars: ✭ 44 (+214.29%)
Mutual labels:  wpf
fea state machines
A Buffet Of C++17 State Machines
Stars: ✭ 19 (+35.71%)
Mutual labels:  state-machines
nodify
High performance and modular controls for node-based editors designed for data-binding and MVVM.
Stars: ✭ 282 (+1914.29%)
Mutual labels:  wpf
PrettyNSharp
Create beautiful and graphically scalable UI controls for your C#/WPF apps.
Stars: ✭ 43 (+207.14%)
Mutual labels:  wpf
WPF-Keyboard-Control
WPF Keyboard Control
Stars: ✭ 53 (+278.57%)
Mutual labels:  wpf
RequestifyTF2
Client side commands for mic spamming and more!
Stars: ✭ 13 (-7.14%)
Mutual labels:  wpf
LiveWallpaper
A tiny win10 (dynamic) wallpaper changer | 巨应壁纸 | 动态壁纸 | Free wallpaper engine
Stars: ✭ 396 (+2728.57%)
Mutual labels:  wpf

A .Net Standard library used to model complicated State Machines

Discord Server NuGet Codacy Badge last commit Build Status

Overview

StateNet's primary purpose is to create a simple way to define and control the flow through pages of an application. However, since its inception the library has grown versatile with usecases ranging from X to Y.

Usage

At its core, StateNet works by defining a network of states, and how those states are connected. Inter-state connections are defined by a list of 'Connections' for a given 'Input' each of which have dynamically-computed probabilities.

For example, consider a network that defines the traffic lights at a pedestrian crossing. The network will have these states: -Red -Yellow -Green -Pending Pedestrians

The network's state will be Green until a pedestrian Triggers Crossing. An equation will then check if the Green state has been active for long enough. If it has, then the odds of moving to Yellow are 100%. If it hasn't been long enough, then the probability of transitioning to Pending Pedestrians is 100%. Once in either the Yellow or Red state, a Trigger such as 'timer-check' might fire every second. Every time timer-check fires, the state will only change back to Green if enough time has passed for pedestrians to have crossed.

How to Configure the Network

List all of the states your application needs. Then consider the relationships between those states in order to determine your system's Inputs (state transition trigger events). Create a connection by defining a source state, input, destination state and an expression which determines the weight of the connection at runtime.

Weights can be as simple or dynamic as you need. For example, a dice will have 6 states, 1 Trigger (roll), and each state-connection (all 36 of them [6X6]) has a hard coded weight of 16.66%. A more complex system might use boolean logic, comparisons or arithmatic expressions to determine the connection weight based on the transition history.

    //Defining the network
    var network = NetworkBuilder.New.SetStartState("A")
	.AddConnection("A", "Next", "B", new ConstantInteger<TransitionHistory>(1))
        .AddConnection("B", "Next", "A", new ConstantInteger<TransitionHistory>(1))
	.Build().Network;

    //Running the engine
    var engine = new StateNetEngine(network, new SystemRandomNumberGenerator());
    engine.OnTransition += (transition) => Console.WriteLine(transition);
    var state1 = engine.CurrentState;   //A
    var state2 = engine.Apply("Next");  //B
    var state2 = engine.Apply("Next");  //A

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].