GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: Add Line Numbers


games with turing machines. WHAT? by baldurk
## initial      final   blank   variable        input   prompt
0               100     .       $               ?       Action? 

## read instruction from tape5
0       ('%','@','$','$','p')   2       ('%','@','$','$','p')   ('T','T','R','T','T')   pick some berries
0       ('%','@','$','$','I')   5       ('%','@','$','$','I')   ('T','T','R','T','T')   print info
0       ('%','@','$','$','$')   7       ('%','@','$','$','x')   ('T','T','R','T','T')   invalid action
0       ('%','@','$','$','.')   666     ('%','@','$','$','.')   ('R','R','R','T','T')   reached end of input without succeeding: FAIL

## invalid action
7       ('%','@','$','$','x')   8       ('%','@','X','$','x')   ('T','T','T','T','T')   print 'X' (invalid action)
8       ('%','@','X','$','x')   0       ('%','@','.','$','=')   ('T','T','L','T','R')   remove 'X' and goto next instr.

## pick some berries
2       ('%','B','$','$','$')   3       ('%','B','$','$','$')   ('T','R','T','T','T')   go left until you find 'B'
2       ('%','$','$','$','$')   2       ('%','$','$','$','$')   ('T','L','T','T','T')   :
3       ('%','-','$','$','$')   4       ('%','+','0','$','$')   ('T','R','R','T','T')   change '-' to '+', print '1'
3       ('%','+','$','$','$')   4       ('%','+','1','$','$')   ('T','R','R','T','T')   change '+' to '+', print '2'

## print info
5       ('%','@','.','$','I')   6       ('%','@','I','$','I')   ('T','T','T','T','T')   print 'I' (info)
6       ('%','@','I','$','I')   0       ('%','@','.','$','=')   ('T','T','L','T','R')   remove 'I' and goto next instr.

## return head2 to its original position and go to the next instruction
4       ('%','@','$','$','$')   0       ('%','@','$','$','$')   ('T','T','L','T','R')   goto to next instr.
4       ('%','$','$','$','$')   4       ('%','$','$','$','$')   ('T','R','T','T','T')   find '@' on tape2