Assertion: machine | /r/HasProperty | *state* s1
Facets:
Source sentences:
text: ;; ;; 10/22/96 3am-5am: Manolis Kamvysselis - manoli@mit.edu ;; ;; Program used to check solutions to a 6.004 problem set ;; Simulation of a Turing machine ;; global variables used by procedures. ;; Those are changed at every step, and must be reinitialized before running a different ;; example, by running: (setup state-graph tape initial-state initial-position) (define *machine* '()) ; the machine currently running (define *state* 's1) ; the state at which the current machine is at (define *position* 0) ; the position at which the tape is reading (define *tape* #()) ; the tape that the current machine is currently running on ;; The following procedure takes in a state graph (see examples below), and turns it ;; to a machine, where each state is represented only once, in a list containing: ;; a structure of the form: ;; ((state (in out move next-state) (in out move next-state) (in out move next-state)) ;; (state2 (in out move next-state)) ;; (state3 (in out move next-state) (in out move next-state))) ;; ;; Each state name is followed by a list of combinations of inputs (read on the tape) ;; and the corresponding output (written on the tape), direction of motion (left or right), ;; and next state the machine will be in. ;; ;; Here's the machine returned by (initialize flip) (as defined at the end of this file) ;; ;; ((s4 (0 0 l h)) ;; (s3 (1 1 r s4) (0 0 l s3)) ;; (s2 (0 1 l s3) (1 0 r s2)) ;; (s1 (0 1 r s2) (1 1 l s1))) (define (initialize state-graph) (define (extend machine states-to-go) (if (null?