Skip to content

OneMaton Software Design Pattern

Moti Barski edited this page Mar 23, 2026 · 1 revision

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.

merits:

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.

how this differs than using the AlgPart objects to construct an algorithm?

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.

example use:

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

Clone this wiki locally