Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -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}
];
];

View file

@ -0,0 +1,18 @@
printMachine[tape_,pos_]:=(mach=IntegerString[tape,2];
ptr=StringReplace[mach,{"0"-> " ","1"->" "}];
Print[mach];Print[StringInsert[ptr,"^",StringLength[ptr]-pos]];);
simpleIncr={"q0,1,1,right,q0","q0,B,1,stay,qf"};
simpleIncr=Map[cmp,simpleIncr]/.B->0;
fin=utm[simpleIncr,7,2];
printMachine[fin[[1]],fin[[2]]];
busyBeaver3S={
"a,0,1,right,b",
"a,1,1,left,c",
"b,0,1,left,a",
"b,1,1,right,b",
"c,0,1,left,b",
"c,1,1,stay,halt"};
fin=utm[Map[cmp,busyBeaver3S],0,0];
printMachine[fin[[1]],fin[[2]]];

View file

@ -0,0 +1,16 @@
probable5S={
"A, 0, 1, right, B",
"A, 1, 1, left, C",
"B, 0, 1, right, C",
"B, 1, 1, right, B",
"C, 0, 1, right, D",
"C, 1, 0, left, E",
"D, 0, 1, left, A",
"D, 1, 1, left, D",
"E, 0, 1, stay, H",
"E, 1, 0, left, A"};
fin=utm[Map[cmp,probable5S],0,0];
]
fin[[1]]//N
3.254757786465838*10^3698