Sounds like a job for state machines like you can build out with a library like xstate[0] (though I'm sure there are similar libraries in whatever language you choose. Python has one called automat[1])
These exist to formalize state logic (current state, computing state, transitioning state etc), you can even produce diagrams based on their definitions. Advanced libraries like xstate even have Actors are part of the core of the library
These exist to formalize state logic (current state, computing state, transitioning state etc), you can even produce diagrams based on their definitions. Advanced libraries like xstate even have Actors are part of the core of the library
[0]: https://stately.ai/docs/xstate
[1]: https://github.com/glyph/Automat