49 std::vector<Symbol> read,
50 std::vector<Symbol> write,
51 std::vector<Direction> dir
62 [[nodiscard]] std::size_t
get_id() const noexcept {
return this->
id_; }
126 if (
auto cmp = this->current_state_ <=> other.current_state_; cmp !=
nullptr)
130 return this->read_symbols_ <=> other.read_symbols_;
170 throw std::out_of_range(
"Tape index out of bounds for read_symbols_");
183 throw std::out_of_range(
"Tape index out of bounds for write_symbols_");
196 throw std::out_of_range(
"Tape index out of bounds for dir_vectors_");
Represents a single state in the finite set of states (Q) of the Turing Machine.
Represents a single symbol on the Turing Machine's tape.
Represents a multi-tape transition rule (δ: Q × Γ^k → Q × Γ^k × {L, R}^k).
State next_state_
Destination state after execution.
void set_next_state(State next) noexcept
Modifies the transition's destination state.
void set_direction_at(std::size_t tape_idx, const Direction &dir) noexcept(false)
Allows granular modification of a specific tape cell.
const State & get_current_state() const noexcept
Retrieves the source state required to trigger this transition.
bool operator==(const Transition &other) const noexcept
Checks equality of transitions based on their semantic identity.
const std::vector< Direction > & get_directions() const noexcept
Retrieves the directions in which each parallel tape head must shift.
void set_directions(std::vector< Direction > dir) noexcept
Modifies the heads' movement direction.
void set_write_symbols(std::vector< Symbol > write) noexcept
Modifies the whole writing symbols block (k-tapes).
State current_state_
Source state for the transition rule.
Transition(std::size_t id, State current, State next, std::vector< Symbol > read, std::vector< Symbol > write, std::vector< Direction > dir) noexcept
Explicit constructor to define a complete multi-tape transition rule.
std::vector< Direction > dir_vectors_
Structural head shift directions vector.
void set_read_symbol_at(std::size_t tape_idx, const Symbol &sym) noexcept(false)
Allows granular modification of a specific tape cell.
std::vector< Symbol > read_symbols_
Expected vector array of symbols on the tracks.
std::size_t id_
Unique runtime identifier for UI and graph edge tracking.
const std::vector< Symbol > & get_read_symbols() const noexcept
Retrieves the collection of symbols that must be present under the tape heads.
auto operator<=>(const Transition &other) const noexcept
Lexicographical ordering of transitions for container storage.
void set_read_symbols(std::vector< Symbol > read) noexcept
Modifies the whole reading symbols block (k-tapes).
std::size_t get_id() const noexcept
Retrieves the unique identifier of this transition rule.
Transition()=default
Default constructor.
const std::vector< Symbol > & get_write_symbols() const noexcept
Retrieves the new symbols that will overwrite the current parallel tape cells.
const State & get_next_state() const noexcept
Retrieves the target state the machine will enter after executing this rule.
void set_write_symbol_at(std::size_t tape_idx, const Symbol &sym) noexcept(false)
Allows granular modification of a specific tape cell.
std::vector< Symbol > write_symbols_
New vector array of symbols to write.
Direction enum class representing the possible directions to move on a Turing Machine.
Direction
Specifies the movement direction of the tape head.
State class to represent a state within the Turing Machine's finite control.
Symbol class to represent the symbols on the Turing Machine's tape.