{"id":22795826,"url":"https://github.com/sakryukov/generic-state-machine","last_synced_at":"2026-05-01T14:34:07.633Z","repository":{"id":265881271,"uuid":"896786811","full_name":"SAKryukov/generic-state-machine","owner":"SAKryukov","description":"Transition system and state machine generic classes can be instantiated with any enumeration types representing the sets of states and the input and output alphabets","archived":false,"fork":false,"pushed_at":"2025-02-03T13:27:05.000Z","size":438,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T18:14:08.354Z","etag":null,"topics":["acceptors","csharp","dotnet","enumeration","finite-state-machine","generics","graph-algorithms","graphs","np-hard","state-machine","transducers","transition-matrix","transition-systems","transitions"],"latest_commit_sha":null,"homepage":"https://www.SAKryukov.org","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SAKryukov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-01T10:01:32.000Z","updated_at":"2025-02-03T13:27:08.000Z","dependencies_parsed_at":"2024-12-01T11:19:29.979Z","dependency_job_id":"6feec46a-3f3d-4d01-bb84-bc9009f74538","html_url":"https://github.com/SAKryukov/generic-state-machine","commit_stats":null,"previous_names":["sakryukov/generic-state-machine"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/SAKryukov/generic-state-machine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAKryukov%2Fgeneric-state-machine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAKryukov%2Fgeneric-state-machine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAKryukov%2Fgeneric-state-machine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAKryukov%2Fgeneric-state-machine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SAKryukov","download_url":"https://codeload.github.com/SAKryukov/generic-state-machine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAKryukov%2Fgeneric-state-machine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32501403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acceptors","csharp","dotnet","enumeration","finite-state-machine","generics","graph-algorithms","graphs","np-hard","state-machine","transducers","transition-matrix","transition-systems","transitions"],"created_at":"2024-12-12T05:08:53.587Z","updated_at":"2026-05-01T14:34:07.587Z","avatar_url":"https://github.com/SAKryukov.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Generic state machine\r\n\r\nThe classes [TransitionSystem](https://SAKryukov.GitHub.io/generic-state-machine#heading-class-transitionsystem),\r\n[Acceptor](https://SAKryukov.GitHub.io/generic-state-machine#heading-class-acceptor),\r\nand [Transducer](https://SAKryukov.GitHub.io/generic-state-machine#heading-class-transducer)\r\ncan be instantiated with any enumeration types representing the sets of states and the input and output alphabets. For example:\r\n\r\n~~~\r\nenum RoomDoorState { Locked, Closed, Opened,\r\n                     OpenedInside, ClosedInside, LockedInside };\r\nTransitionSystem\u003cRoomDoorState\u003e transitionSystem = new();\r\n~~~\r\n\r\nThen the transition graph can be populated:\r\n\r\n~~~\r\ntransitionSystem.AddValidStateTransition(RoomDoorState.ClosedInside, RoomDoorState.LockedInside,\r\n    (start, finish) =\u003e {\r\n        // command hardware actuator to lock the door\r\n});\r\n//...\r\ntransitionSystem.AddInvalidStateTransition(RoomDoorState.Locked, RoomDoorState.LockedInside,\r\n    (start, finish) =\u003e\r\n        $\"You cannot get in through the locked door\"));\r\n~~~\r\n\r\nNote that both valid and some invalid transitions can be defined. The purpose of the invalid transition is to provide some information on why the transition is not permitted.\r\nBoth valid and invalid transitions can come with optional handlers accepting two arguments, the enumeration values representing starting and finishing states. In the case of a valid transition, the handler provides a side effect of transition.\r\nFor example, in the hardware automation applications, it can operate the hardware. In the case of an invalid transition, the handler returns a comment string explaining why the transition is not permitted.\r\n\r\nPlease see the comprehensive [API documentation](https://SAKryukov.GitHub.io/generic-state-machine).\r\n\r\nFor the rationale, general ideas, and mathematical aspects, please see the\r\n[original publication](https://sakryukov.github.io/publications/2024-12-29.Enumeration-Based-Generic-State-Machine.html).\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsakryukov%2Fgeneric-state-machine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsakryukov%2Fgeneric-state-machine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsakryukov%2Fgeneric-state-machine/lists"}