opsftw

BF: unmetered user-input

Sep 3rd, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Takes in an undetermined amount of user input and echoes it back out once the user presses 'enter'.
  2.  
  3. > ;moves one cell over to reserve the first cell
  4. + ;Makes cell positive so loop may start
  5. [
  6.     , ;takes one char of user input
  7.     [ ;loop: move input into a cell 2 cells to the right
  8.         >>+<<-
  9.     ]
  10.     >> ;move back to the cell that data was moved to
  11.     [ ;move the input from the holding cell and coppy it into both the origeonal cell and the one right after it
  12.         <+<+>>-
  13.     ]
  14.     <---------- ;goes back one to the coppy of the origeonal cell and tests to see if its 10 (enter)
  15. ] ;if it is then loop will exit
  16. <---------- ;remove extra 10 (enter)
  17. <[<] ;go back to the first cell
  18. +[>.] ;print out all the cells
  19. <[[-]<] ;return all the cells back to 0
  20.  
  21.  
  22.  
  23.  
  24. Compact version of the script:
  25. >+[,[>>+<<-]>>[<+<+>>-]<----------]<----------<[<]+[>.]<[[-]<]
Advertisement
Add Comment
Please, Sign In to add comment