diff --git a/src/main.rs b/src/main.rs index 263a495..314bf1a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,8 +6,12 @@ mod turing; const LENGTH: usize = 64; fn main() { + // create turing machine let mut machine = TuringMachine::new(); + // set pointer start position + machine.set_pointer(0); + // config turing machine belt machine.set_belt(1, Value::Hash); machine.set_belt(2, Value::One); diff --git a/src/turing.rs b/src/turing.rs index 80e25d5..2c822a4 100644 --- a/src/turing.rs +++ b/src/turing.rs @@ -57,6 +57,11 @@ impl TuringMachine { self.belt[index] = value; } + pub fn set_pointer(&mut self, index: usize) -> () { + // set pointer start position + self.pointer = index; + } + pub fn set_transition(&mut self, state: u64, value: Value, next_state: u64) -> () { // If the State is not in the HashMap, add it if self.transitions.get(&state).is_none() {