This repository includes several Python programs simulating theoretical automata, such as NFAs, DFAs, Mealy Machines, and toy-model state machines. These are designed for educational purposes to help understand core concepts in automata theory.
-
nfa_example1.py
Accepts binary strings ending in '0' using NFA simulation. -
nfa_example2.py
Accepts binary strings ending in '1'. -
nfa_example3.py
Hybrid simulation resembling DFA, using composite states like'AB'
and'BC'
. -
nfa_dfa_example1.py
Simulates both an NFA and its equivalent DFA. Checks string acceptance for each.
-
dfa_example1.py
DFA for strings that start with '0'. -
dfa_example2.py
DFA that accepts only binary strings of exactly length 2. -
dfa_example3.py
DFA that rejects strings containing 'aabb'. -
dfa_example4.py
DFA that accepts strings that either contain '01' or a '1' followed by a '0'.
twos_complement_mealy_machine.py
Computes two's complement of a binary number using a Mealy machine-like approach.
-
Marble Rolling Toy State Table.py
Generates all transitions of a marble toy system using binary lever states. Outputs a CSV file. -
2.2.1.52.MarbleDFA.py
Simulates a DFA using lever states (e.g.,'000r'
,'101a'
) to represent positions. Accepts'A'
or'B'
inputs and tracks lever state transitions interactively. -
Pre-Switch Marble Rolling Toy Table.py
Models state transitions before the marble drops, including path logic like"A -> x1 -> D"
. Outputs a transition table as CSV.
- Make sure Python 3 is installed.
- Open terminal and run any script:
python dfa_example1.py
- Most scripts prompt for input strings like '010', 'abba', or 'AABB'.
💡 Educational Goals Understand how DFAs and NFAs process strings.
Explore conversion between NFA and DFA.
Simulate real-world inspired state machines like a marble toy.
Practice working with binary operations using automata principles.