News for hackers. Stuff that matters.
Re:C++ State Machines by dimitrov on Tuesday April 02, 2019 @06:24PM (#19559165)
Well another OO way would be to add a state member to the Heroine class and create a state class for every possible state (X,Y,Z). Each state can then be responsible for interpreting the input and transitioning to the next appropriate state (if any)
Re:C++ State Machines by eismcc on Tuesday April 02, 2019 @06:56PM (#19559377)
How do you manage combinatorial explosion as states increase?
Re:C++ State Machines by dimitrov on Tuesday April 02, 2019 @07:05PM (#19559420)
The proposed state table is hardly more scalable. It's obviously not infinitely scalable but In my proposed way, you only have to specify the cases where a state transition actually occurs.
Re:C++ State Machines by eismcc on Tuesday April 02, 2019 @11:21PM (#19560490)
What you describe feels more like case classes.
Re:C++ State Machines by signa11 on Tuesday April 02, 2019 @09:08PM (#19559996)
one possibility is to use hierarchical-state-machines (HSM), which allow (encourage even ?) the decomposition of state-machine into common behavior for reuse across states.

HSM have been there for a while, being proposed in '84 (!) by David Harel under the name 'statecharts'