11#ifndef TURING_MACHINE_HPP
12#define TURING_MACHINE_HPP
22#include <unordered_map>
51 std::set<State> states,
53 std::size_t tape_count
64 [[nodiscard]]
bool load_input(std::string_view input)
noexcept(
false);
74 bool step() noexcept(false);
80 void run() noexcept(false);
122 [[nodiscard]]
const std::vector<Tape> &
get_tapes() const noexcept {
return this->
tapes_; }
129 [[nodiscard]]
const std::unordered_map<std::size_t, Transition> &
162 std::vector<Symbol> read,
163 std::vector<Symbol> write,
164 std::vector<Direction> dir
195 return &(it->second);
227 std::unordered_map<std::size_t, Transition>
Alphabet class to manage the collection of valid symbols for the Turing Machine.
Represents the formal alphabet ( or ) of a Turing Machine.
Represents a single state in the finite set of states (Q) of the Turing Machine.
Represents a multi-tape transition rule (δ: Q × Γ^k → Q × Γ^k × {L, R}^k).
The central execution engine representing a deterministic Multi-Tape Turing Machine.
Alphabet tape_alphabet_
Structural execution workspace vocabulary ( ).
const std::set< State > & get_states() const noexcept
Retrieves the complete formal set of legal operational state conditions.
std::size_t id_counter_
Unique runtime identifier counter for transitions.
bool step() noexcept(false)
Executes a single computational transition step across all parallel tapes.
bool load_input(std::string_view input) noexcept(false)
Validates an input word against the input alphabet and loads it onto Tape 0.
const Alphabet & get_input_alphabet() const noexcept
Retrieves the formal input validation alphabet.
const std::vector< Tape > & get_tapes() const noexcept
Retrieves the entire collection layout of parallel tape tracks.
const Alphabet & get_tape_alphabet() const noexcept
Retrieves the wider operational tape workspace alphabet.
void run() noexcept(false)
Loops execution triggers calling step() continuously until a halting condition occurs or the safety s...
std::vector< Tape > tapes_
Collection of k dynamic memory layouts.
State current_state_
Active contextual processing marker.
std::set< State > states_
Valid configurations collection.
Alphabet input_alphabet_
Input validation vocabulary ( ).
const std::unordered_map< std::size_t, Transition > & get_transitions() const noexcept
Retrieves the entire lookup table of transitions.
TuringMachine() noexcept
Default constructor.
State start_state_
Factory default backup tracking state.
std::size_t tape_count_
Cardinality multiplier tracking active tapes (k).
const State & get_start_state() const noexcept
Retrieves the factory default initial state configuration.
bool contains_transition(std::size_t id) const noexcept
Checks whether the machine contains a specific transition.
bool remove_transition(std::size_t id) noexcept
Removes a transition from the machine.
std::size_t get_tape_count() const noexcept
Retrieves the total cardinality of parallel tapes operating inside the machine.
const State & get_current_state() const noexcept
Retrieves the active operational state context marker.
Transition * get_transition(std::size_t id) noexcept
Retrieves a pointer to a transition by its unique runtime identifier.
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.
std::unordered_map< std::size_t, Transition > transitions_
Lookup table for transitions by ID.
State class to represent a state within the Turing Machine's finite control.
Tape class representing the infinite memory structure of the Turing Machine.
Transition class representing a multi-tape rule in the TM's transition function.