You need to read the FSM diagrams very carefully🙂 Suppose you can get to the int1 state by the DIGIT_1_9 event from three states, you need to keep in mind that by the time you find yourself in the int1 state, the actual digit is gone, so you must repeat what is being done inside int1 exactly three times in three different places, which can be seen in the source text of the FSM.

What if I have 20 transitions from different locations... something is wrong🤔


Ha! And another implementation of the hierarchical copes with the same calculator without duplicating the code (more precisely, it's still there, but on a smaller scale and is localized).
The thing is that in the former machine, the in_enter() mechanism was implemented through a simple ON_ENTER event, which automatically destroyed all traces of the event that led to this very enter😉

· · Web · 0 · 0 · 2
Sign in to participate in the conversation
Mastodon @ SDF

"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko