-
Notifications
You must be signed in to change notification settings - Fork 1
OneMaton Software Design Pattern
the OneMaton software design pattern enables the construction of Automata(state machines) by adding each state(Automaton) with 1 line of code.
1 capsulation of states
2 clean code
3 modular reusable states
4 Lego like algorithm construction
5 the skill is only attentive to the triggers of the active automaton(current state)
6 in the python version automatons are methods or functions.
1 activation triggers do not affect the active automata whereas with algparts you end up calling an additional algorithm while the older one runs unless you run an extra step to manage that.
2 the algorithmic queue is free because only short immediate actions are sent, run and done. whereas running an automata via a algparts keeps an algorithm actively listening for triggers while its in the algorithm que.
class AutomataTest(Automata):
def __init__(self):
super().__init__()
self.automatas[0] = AtmtStrTrg("test1",self).action # declares automata starts and move to next state
self.automatas[1] = AtmtDeclare(self, Responder("waiting", "waitin", "wait maxing")).action
# move to next state after "ok"
whilst = Responder("process in progress", "process underway mkay")
cancel = Responder("cancelling")
finished = Responder("process completed")
process = AtmtProcessV1(self, whilst,cancel,finished)
self.automatas[2] = process.action # move to next state after timeout(or cancel to reset to state 0)see the OneMaton code at: https://github.com/yotamarker/LivinGrimoire/blob/main/livingrimoire%20start%20here/LivinGrimoire%20python%20easy%20start%20packet/DLC/OneMaton.py