Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -0,0 +1,18 @@
|
|||
left = 1; right = -1; stay = 0;
|
||||
cmp[s_] := ToExpression[StringSplit[s, ","]];
|
||||
utm[rules_, initial_, head_] :=
|
||||
Module[{tape = initial, rh = head, n = 1},
|
||||
Clear[nxt];
|
||||
nxt[state_, field_] :=
|
||||
nxt[state, field] = Position[rules, {rules[[state, 5]], field, _, _, _}][[1, 1]];
|
||||
n = Position[rules, {rules[[n, 1]], BitGet[tape, rh], _, _, _}][[1,1]];
|
||||
While[rules[[n, 4]] != 0,
|
||||
If[rules[[n, 3]] != BitGet[tape, rh],
|
||||
If[rules[[n, 3]] == 1, tape = BitSet[tape, rh],
|
||||
tape = BitClear[tape, rh]]];
|
||||
rh = rh + rules[[n, 4]];
|
||||
If[rh < 0, rh = 0; tape = 2*tape];
|
||||
n = nxt[n, BitGet[tape, rh]];
|
||||
]; {tape, rh}
|
||||
];
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue