September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,6 +1,7 @@
|
|||
function tm(d,s,e,i,b,t,... r) {
|
||||
document.write(d, '<br>')
|
||||
if (i<0||i>=t.length) return
|
||||
var re=new RegExp(b,'g')
|
||||
write('*',s,i,t=t.split(''))
|
||||
var p={}; r.forEach(e=>((s,r,w,m,n)=>{p[s+'.'+r]={w,n,m:[0,1,-1][1+'RL'.indexOf(m)]}})(... e.split(/[ .:,]+/)))
|
||||
for (var n=1; s!=e; n+=1) {
|
||||
|
|
@ -13,7 +14,7 @@ function tm(d,s,e,i,b,t,... r) {
|
|||
function write(n, s, i, t) {
|
||||
t = t.join('')
|
||||
t = t.substring(0,i) + '<u>' + t.charAt(i) + '</u>' + t.substr(i+1)
|
||||
document.write((' '+n).slice(-3).replace(/ /g,' '), ': ', s, ' [', t.replace(b,' ','g'), ']', '<br>')
|
||||
document.write((' '+n).slice(-3).replace(/ /g,' '), ': ', s, ' [', t.replace(re,' '), ']', '<br>')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -24,16 +25,14 @@ tm( 'Unary incrementer',
|
|||
'a.1: 1, L, a',
|
||||
'a.B: 1, S, h'
|
||||
)
|
||||
|
||||
|
||||
tm( 'Unary adder',
|
||||
1, 0, 0, '0', '1110111',
|
||||
'1.1: 0, R, 2', // write 0 rigth goto 2
|
||||
'2.0: 0, S, 0', // if (0) halt
|
||||
'2.1: 0, R, 3', // write 0 rigth goto 3
|
||||
'3.1: 1, R, 3', // while (1) rigth
|
||||
'3.0: 1, S, 0', // write 1 halt
|
||||
'2.1: 1, R, 2', // while (1) rigth
|
||||
'2.0: 1, S, 0' // write 1 stay halt
|
||||
)
|
||||
|
||||
|
||||
tm( 'Three-state busy beaver',
|
||||
1, 0, 0, '0', '0',
|
||||
'1.0: 1, R, 2',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue