Pointer-based Minsky machine

From Esolang
Jump to navigation Jump to search

Pointer-based Minsky machine is a computational model created by User:Ractangle. It's basically just a General Minsky Machine but instead of using registries as arguments in commands. You instead just use the good'ol pointer that points to a registry

The notation

Command Action
A Adds a registry to the pointer stack
R Moves the registry pointer to the right
L Moves the registry pointer to the left
I Increments the current pointing registry
D Decrements the current pointing registry is the current pointing registry is not 0. If the current pointing registry is 0. It checks the n th registry (specified by the argument next to D) and goes to command n (spefied by the n th value of the cell)

Implementations

Python

def PBMM(c):
    p=0;r=[0];pos=0
    while p<len(c):
     if c[p]=="A":r.append(0)
     elif c[p]=="R":pos+=1
     elif c[p]=="L":pos-=1
     elif c[p]=="I":r[pos]+=1
     elif c[p]=="D":
      if r[pos]>0:r[pos]-=1
      else:p=r[int(c[p+1])]-1

Computational class

This variant of a Minsky machine might be able to simulate a turing machine. Although it is not proven yet