{"id":13530824,"url":"https://github.com/JulianDicken/FastSM","last_synced_at":"2025-04-01T19:30:41.471Z","repository":{"id":109734414,"uuid":"499261696","full_name":"JulianDicken/FastSM","owner":"JulianDicken","description":null,"archived":true,"fork":false,"pushed_at":"2024-02-16T07:08:05.000Z","size":19,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-02T17:36:31.841Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Game Maker Language","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/JulianDicken.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}},"created_at":"2022-06-02T19:19:07.000Z","updated_at":"2024-10-24T01:09:33.000Z","dependencies_parsed_at":"2024-04-13T01:58:25.493Z","dependency_job_id":"231d1eb5-d733-43cc-bc06-0539b109419f","html_url":"https://github.com/JulianDicken/FastSM","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianDicken%2FFastSM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianDicken%2FFastSM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianDicken%2FFastSM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianDicken%2FFastSM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JulianDicken","download_url":"https://codeload.github.com/JulianDicken/FastSM/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246700077,"owners_count":20819822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-01T07:00:55.967Z","updated_at":"2025-04-01T19:30:41.010Z","avatar_url":"https://github.com/JulianDicken.png","language":"Game Maker Language","funding_links":[],"categories":["State Machines"],"sub_categories":["Recommendations"],"readme":"# FastSM\nFastSM aims to be a more lightweight alternative to the fantastic SnowState library by [Sahaun](https://github.com/sohomsahaun/SnowState/).\nFastSM employs different design paradigms which make it more flexible in certain cases, while making it more restrictive in others.\nHard limits FastSM has are :\n- There can never be more than 64 State Tags per FSM\n- There can never be more than 64 States per FSM if you are using the allow/forbid feature of state transitions.\n \nI will be documenting FastSM properly soon but for now you can find example code here :\n```js\nenum Tag {\n    A,\n    B,\n    C\n}\nenum State {\n    None, //required, any name allowed\n    Foo,\n    Bar,\n    Baz,\n    MAX //QoL\n}\nenum Trigger {\n    A,\n    MAX\n}\nfsm = new FastSM(State.MAX, Trigger.MAX);\nfsm.event_add_default(\"update\");\n\nfsm.add( State.Baz, {\n    name : \"I should never show up in this example!\",\n    enter : function(this) {\n       show_debug_message(this.name)\n    }\n});\n\nfsm.add( State.Bar, {\n    name : \"I should show up in this example!\",\n    tags : Tag.C,\n    enter : function(this) {\n       show_debug_message(this.name)\n    }, \n    update : function() {\n         show_debug_message(\"update should be called!\")\n    }\n});\n\nfsm.add( State.Foo, {\n    name : \"I am the entry state!\",\n    tags : [Tag.A, Tag.B],\n    enter : function(this) {\n        show_debug_message(this.name)\n    }\n});\n\nfsm.trigger_add( Trigger.A, {\n    name : \"Trigger A\",\n    include: all,\n    forbid: State.Bar,\n    trigger : function(_source) {\n        switch _source {\n            case State.Foo:\n                return State.Bar;\n            break;\n            case State.Bar:\n                return State.Baz;\n            break;\n            default:\n                return State.None;\n        }\n    }\n});\n\nfsm.build().start( State.Foo );\nfsm.trigger( Trigger.A );\nfsm.trigger( Trigger.A );\nfsm.trigger( Trigger.A );\nfsm.update();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJulianDicken%2FFastSM","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJulianDicken%2FFastSM","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJulianDicken%2FFastSM/lists"}