###################################################################### # busybeaver3.yvtm # # A .yvtm file (yaml virtual turing machine) # is a representation of a Turing machine. # # See: # - http://en.wikipedia.org/wiki/Turing_machine # - https://en.wikipedia.org/wiki/Busy_beaver # - http://www.yaml.org/start.html # # There are libraries for reading YAML file for lots of coding # languages. For example, this python code # # >>> import yaml # >>> turing = yaml.load(open('busybeaver3.yvtm')) # # would read this .yvtm file into this data structure # # turing = {'tape' : '0', # 'accept' : [], # 'reject' : [], # 'blank' : '0', # 'machine': [['one', '0', 'two', '1', 'right'], # ['one', '1', 'HALT', '1', 'right'], # ['two', '0', 'three','0', 'right'], # ['two', '1', 'two', '1', 'right'], # ['three', '0', 'three','1', 'left'], # ['three', '1', 'one', '1', 'left']] # } # # Notes: # - The tape has blank symbols as far as needed to the left and right. # - The leftmost symbol in the "tape" spec is the first read. # - The move command is one of (right, left, stay). # - The machine stops when either of these two things happens. # - It moves into any of the accept or reject states. # - There is no appropriate rule to apply. # - The symbols, states, and strings in the options and rules may need # quotes depending on what characters they contain. # For example, if that spec below was # tape: 0011 # then YAML would treat 0011 as a number and ignore the leading zeros. # See the YAML spec for the details. If in doubt, use quotes. # # See ./yvtm.py for an implementation of a virtual turing machine # that reads and executes this file. # # Jim Mahoney | Oct 2016 | MIT License ##################################################################### tape: "0" start: one blank: "0" accept: [] reject: [] machine: # current read next write move # state symbol state symbol to # ----- ------ -------- ----- ----- - [ one, 0, two, 1, right ] - [ one, 1, HALT, 1, right ] - [ two, 0, three, 0, right ] - [ two, 1, two, 1, right ] - [ three, 0, three, 1, left ] - [ three, 1, one, 1, left ]