|
MTMS main
Modern Turing Machine Simulator
|
The central execution engine representing a deterministic Multi-Tape Turing Machine. More...
#include <tm.hpp>
Public Member Functions | |
| std::size_t | add_transition (State current, State next, std::vector< Symbol > read, std::vector< Symbol > write, std::vector< Direction > dir) noexcept(false) |
| Adds a transition to the machine. | |
| bool | contains_transition (std::size_t id) const noexcept |
| Checks whether the machine contains a specific transition. | |
| const State & | get_current_state () const noexcept |
| Retrieves the active operational state context marker. | |
| const Alphabet & | get_input_alphabet () const noexcept |
| Retrieves the formal input validation alphabet. | |
| const State & | get_start_state () const noexcept |
| Retrieves the factory default initial state configuration. | |
| const std::set< State > & | get_states () const noexcept |
| Retrieves the complete formal set of legal operational state conditions. | |
| const Alphabet & | get_tape_alphabet () const noexcept |
| Retrieves the wider operational tape workspace alphabet. | |
| std::size_t | get_tape_count () const noexcept |
| Retrieves the total cardinality of parallel tapes operating inside the machine. | |
| const std::vector< Tape > & | get_tapes () const noexcept |
| Retrieves the entire collection layout of parallel tape tracks. | |
| Transition * | get_transition (std::size_t id) noexcept |
| Retrieves a pointer to a transition by its unique runtime identifier. | |
| const std::unordered_map< std::size_t, Transition > & | get_transitions () const noexcept |
| Retrieves the entire lookup table of transitions. | |
| bool | load_input (std::string_view input) noexcept(false) |
| Validates an input word against the input alphabet and loads it onto Tape 0. | |
| bool | remove_transition (std::size_t id) noexcept |
| Removes a transition from the machine. | |
| void | run () noexcept(false) |
| Loops execution triggers calling step() continuously until a halting condition occurs or the safety step counter threshold breaks execution. | |
| bool | step () noexcept(false) |
| Executes a single computational transition step across all parallel tapes. | |
| TuringMachine () noexcept | |
| Default constructor. | |
| TuringMachine (Alphabet input_alpha, Alphabet tape_alpha, std::set< State > states, State initial_state, std::size_t tape_count) noexcept(false) | |
| Explicit constructor to fully instantiate a Multi-Tape Turing Machine configuration. | |
Private Attributes | |
| State | current_state_ |
| Active contextual processing marker. | |
| std::size_t | id_counter_ {0} |
| Unique runtime identifier counter for transitions. | |
| Alphabet | input_alphabet_ |
Input validation vocabulary ( ![]() | |
| State | start_state_ |
| Factory default backup tracking state. | |
| std::set< State > | states_ |
| Valid configurations collection. | |
| Alphabet | tape_alphabet_ |
Structural execution workspace vocabulary ( ![]() | |
| std::size_t | tape_count_ |
| Cardinality multiplier tracking active tapes (k). | |
| std::vector< Tape > | tapes_ |
| Collection of k dynamic memory layouts. | |
| std::unordered_map< std::size_t, Transition > | transitions_ |
| Lookup table for transitions by ID. | |
The central execution engine representing a deterministic Multi-Tape Turing Machine.
Manages an arbitrary number of parallel structural Tapes, dispatching updates simultaneously using synchronized multi-dimensional transition rules.
|
inlinenoexcept |
|
explicit |
Explicit constructor to fully instantiate a Multi-Tape Turing Machine configuration.
| input_alpha | The initial string input validation alphabet ( ![]() |
| tape_alpha | The wider tape work alphabet ( ![]() |
| states | The complete set of legal operational conditions (Q). |
| initial_state | The point of origin state where processing starts ( ![]() |
| tape_count | The total number of parallel tape tracks available (k). |
|
inline |
Adds a transition to the machine.
Allocates and stores a new multi-tape rule inside the internal lookup map. This operation provides a strong exception guarantee; if an exception is thrown, the machine's state and internal ID counter remain completely unmodified.
| current | The required state to trigger this transition. |
| next | The target state the machine will transition into. |
| read | The collection of symbols expected under each parallel tape head. |
| write | The collection of new symbols to overwrite onto each tape track. |
| dir | The collection of displacement directions for each tape head. |
| std::bad_alloc | If the internal map fails to allocate memory for the new node or during an automatic rehash operation. |
Definition at line 159 of file tm.hpp.
References id_counter_, and transitions_.
|
inlinenoexcept |
Checks whether the machine contains a specific transition.
| id | The unique runtime identifier of the transition. |
Definition at line 214 of file tm.hpp.
References transitions_.
|
inlinenoexcept |
Retrieves the active operational state context marker.
Definition at line 116 of file tm.hpp.
References current_state_.
Referenced by render_dashboard(), and run_cli_session().
|
inlinenoexcept |
Retrieves the formal input validation alphabet.

Definition at line 86 of file tm.hpp.
References input_alphabet_.
|
inlinenoexcept |
Retrieves the factory default initial state configuration.

Definition at line 110 of file tm.hpp.
References start_state_.
|
inlinenoexcept |
|
inlinenoexcept |
Retrieves the wider operational tape workspace alphabet.

Definition at line 95 of file tm.hpp.
References tape_alphabet_.
|
inlinenoexcept |
Retrieves the total cardinality of parallel tapes operating inside the machine.
Definition at line 139 of file tm.hpp.
References tape_count_.
|
inlinenoexcept |
Retrieves the entire collection layout of parallel tape tracks.
Definition at line 122 of file tm.hpp.
References tapes_.
Referenced by render_dashboard().
|
inlinenoexcept |
Retrieves a pointer to a transition by its unique runtime identifier.
| id | The unique runtime identifier of the transition. |
Definition at line 190 of file tm.hpp.
References transitions_.
|
inlinenoexcept |
Retrieves the entire lookup table of transitions.
Definition at line 130 of file tm.hpp.
References transitions_.
| bool TuringMachine::load_input | ( | std::string_view | input | ) |
Validates an input word against the input alphabet and loads it onto Tape 0.
Validates input string and loads it exclusively onto the FIRST tape (Tape 0).
Clears all secondary tracks, filling them with virtual blank context variables.
| input | The raw character view representation to parse. |
All secondary work tapes (1 to k-1) remain empty (filled with virtual kBlank).
Definition at line 41 of file tm.cpp.
References String::is_valid_for().
Referenced by run_cli_session().
|
inlinenoexcept |
Removes a transition from the machine.
| id | The unique runtime identifier of the transition to remove. |
Definition at line 206 of file tm.hpp.
References transitions_.
| void TuringMachine::run | ( | ) |
Loops execution triggers calling step() continuously until a halting condition occurs or the safety step counter threshold breaks execution.
Operational runtime loop triggering sequential computation steps.
Integrates a safety threshold loop counter (kMaxSteps) to force-halt execution and prevent infinite runtime hanging situations inside the sandbox environment.
| bool TuringMachine::step | ( | ) |
Executes a single computational transition step across all parallel tapes.
Executes a single computational transition step across ALL parallel tapes.
Queries multi-tape rules matching the active conditions vector layout.
Scans symbols from every tape head, matches the collective tuple against the multi-tape transition matrix, and updates all tracks simultaneously.
Definition at line 61 of file tm.cpp.
References current_state_, Transition::get_directions(), Transition::get_next_state(), Transition::get_write_symbols(), State::is_accept(), tape_count_, tapes_, and transitions_.
Referenced by run(), and run_cli_session().
|
private |
Active contextual processing marker.
Definition at line 225 of file tm.hpp.
Referenced by get_current_state(), and step().
|
private |
Unique runtime identifier counter for transitions.
Definition at line 220 of file tm.hpp.
Referenced by add_transition().
|
private |
Input validation vocabulary ( 
Definition at line 221 of file tm.hpp.
Referenced by get_input_alphabet().
|
private |
Factory default backup tracking state.
Definition at line 224 of file tm.hpp.
Referenced by get_start_state().
|
private |
|
private |
Structural execution workspace vocabulary ( 
Definition at line 222 of file tm.hpp.
Referenced by get_tape_alphabet().
|
private |
Cardinality multiplier tracking active tapes (k).
Definition at line 229 of file tm.hpp.
Referenced by get_tape_count(), and step().
|
private |
Collection of k dynamic memory layouts.
Definition at line 226 of file tm.hpp.
Referenced by get_tapes(), and step().
|
private |
Lookup table for transitions by ID.
Definition at line 228 of file tm.hpp.
Referenced by add_transition(), contains_transition(), get_transition(), get_transitions(), remove_transition(), and step().