-IN: turing
USING: arrays assocs io kernel math namespaces
-prettyprint sequences strings vectors words ;
+prettyprint sequences strings vectors words accessors ;
+IN: turing
! A turing machine simulator.
: turing-step ( -- )
#! Do one step of the turing machine.
next-state
- dup state-sym set-sym
- dup state-dir position [ + ] change
- state-next state set ;
+ dup sym>> set-sym
+ dup dir>> position [ + ] change
+ next>> state set ;
: c ( -- )
#! Print current turing machine state.