|
TuringSim
C++ framework to simulate abstract computing models
|
3 #include <symbol/symbolPattern.h>
4 #include <transition/Turing/localTuringMachineTransition.h>
18 typename ApplyHelperType_,
19 bool hasHalfTape =
false
31 static_assert(std::is_same_v<SymbolType_, SymbolType>);
33 static_assert(std::is_same_v<StateType_, StateType>);
34 static_assert(std::is_same_v<StateType, StateType_>);
71 auto&& [postState, postSymbol, movement] = this->
getPostElements(state, tape.read(), std::move(helper));
72 tape.write(postSymbol);
74 if(movement == Movement::HALT) {
OneStepTuringMachineTransition & operator=(const OneStepTuringMachineTransition &)=default
The default copy assignment operator.
virtual StateType apply(const StateType &state, Memory::TapeLike< hasHalfTape, SymbolType_ > &tape, ApplyHelperType &&helper, bool &running) const override final
Apply a previously matching transition and return the new state.
std::monostate ApplyHelperType
The type of apply helpers.
std::conditional_t< isHalfTape, HalfTape::HalfTape< SymbolType >, Tape::Tape< SymbolType > > TapeLike
Transitions for Turing machines.
StateType_ StateType
The type of states.
StorageType_::Movement Movement
The type of movement on the tape.
OneStepTuringMachineTransition(OneStepTuringMachineTransition &&)=default
The default move constructor.
StateType_ StateType
The type of states.
ApplyHelperType_ ApplyHelperType
The type of apply helpers.
std::integral_constant< bool, hasHalfTape > HasHalfTape
Whether the tape is a half-tape or a full tape.
Turing machine transitions that reads only the current symbol, writes a symbol, performs a simple mov...
virtual std::tuple< StateType, SymbolType, Movement > getPostElements(const StateType &state, const SymbolType &symbol, ApplyHelperType &&helper) const =0
get the new state, the new symbol and the movement to execute.
OneStepTuringMachineTransition()=default
The default constructor.
OneStepTuringMachineTransition(const OneStepTuringMachineTransition &)=default
The default copy constructor.
OneStepTuringMachineTransition & operator=(OneStepTuringMachineTransition &&)=default
The default move assignment operator.
SymbolType_ SymbolType
The type of symbols on the tape.
virtual ~OneStepTuringMachineTransition() override=default
The default virtual destructor.
StorageType_ StorageType
The type of storage.
Base class for Turing machine transitions that only reads the current symbol on the tape to decide if...