Advertisement
Guest User

Challenge 213 Cellular Automata

a guest
Sep 8th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. +++++++++++++++++++++++++>>>>>>
  2. //read all input
  3. ,[>,] >+
  4. //return pointer to (3)
  5. <<[<] <<<<<
  6. // loop for 25
  7. [-
  8. >>>>>>
  9. //sliding loop to end of input
  10. [
  11. //check if first value is blank if so treat it as 0
  12. <<<[-]>[-]+>
  13. [
  14. //if true code / not used
  15. <-]<
  16. [>
  17. //if false code
  18. //if true code / set to 0
  19. ++++++++++++++++++++++++++++++++++++++++++++++++
  20. <-<]
  21. >>
  22. //check if third value is blank if so treat use first value
  23. <<[-]+>[-]>>>
  24. [
  25. <<
  26. <<[-]>>
  27. //Xor compare 3rd value to first
  28. [<+>-]+
  29. >>[<<<-<+>>>>-]
  30. <<<<[>>>>+<<<<-]
  31. >[>-<[-]]>
  32. //set value of next row based on if first value is true or false
  33. <+>
  34. [
  35. //if true code
  36.  
  37. <<<
  38. ++++++++++++++++++++++++++++++++++++++++++++++++
  39. >>>
  40. <-]<
  41. [>
  42. //if false code
  43. <<<
  44. +++++++++++++++++++++++++++++++++++++++++++++++++
  45. >>>
  46. <-<]>>>>
  47. [<<<+>>>-]
  48. ]
  49. <<<[>>>+<<<-]
  50. // copy first value to next row
  51. <[>>[-<<<+>>>]<<
  52. -]>>>
  53. //move and repeat
  54. >]
  55. <[-]>
  56.  
  57. //return carriage
  58. >>>>++++++++++.[-]<<<<
  59. //sliding loop to reposition input values back to original location
  60. <<<<<[[->>>>+<<<<]<]
  61. //read new values
  62. >>>>>[.>] <[<]<<<<<
  63. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement