Guest User

Untitled

a guest
Jun 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. BACKTRACK is false
  2. FINDLOOP is false
  3. BOTTLENECK is false
  4.  
  5. CUR is the current pixel
  6. MARK is the first mark, and is not set
  7. MARK2 is the second mark, and is not set
  8.  
  9.  
  10. Start by turning to face the next direction
  11. main loop:
  12. if CUR is bound by 4 edge pixels
  13. paint CUR
  14. all possible pixels have been filled, so exit the routine
  15.  
  16. if CUR is bound by 3 edge pixels
  17. paint CUR
  18. move forward
  19. turn to next direction
  20. continue main loop
  21.  
  22. if CUR is bound by 2 edge pixels
  23. if the two bounding edge pixels are not across from each other, and the corner opposite both edge pixels is not filled
  24. paint CUR
  25. move forward
  26. turn to next direction
  27. continue main loop
  28. else
  29. if BACKTRACK is false and  MARK is not set
  30. set MARK to CUR's location and direction
  31. set FINDLOOP to false
  32. else, if MARK is set
  33. if MARK2 is not set
  34. if CUR is at MARK's location
  35. if CUR's direction is the same as MARK's
  36. remove MARK
  37. set BACKTRACK to false
  38. else
  39. set BACKTRACK to true
  40. set CUR to MARK's direction
  41. set FINDLOOP to false
  42. else, if FINDLOOP is true
  43. set MARK2 to CUR's location and direction
  44. else
  45. if CUR is at MARK's location
  46. set CUR to MARK2's direction and location
  47. remove MARK
  48. remove MARK2
  49. set BACKTRACK to false
  50. else if CUR is at MARK2's location
  51. set MARK to MARK2's direction and location
  52. set CUR's direction to MARK2's direction
  53. remove MARK2
  54. if BACKTRACK is false and MARK is not set
  55. if BOTTLENECK is false
  56. paint CUR
  57. set BOTTLENECK to false
  58. move according to boundaries
  59. continue main loop
  60.  
  61. if CUR is bound by 1 edge pixel
  62. if BACKTRACK is true and FINDLOOP is false
  63. set FINDLOOP to true
  64. else, if neither  of the corners opposite the bounding pixel are filled
  65. paint CUR
  66. move forward
  67. turn to next direction
  68. continue main loop
  69. move according to boundaries
  70. continue main loop
  71.  
  72. if CUR is bound by 0 edge pixels
  73. if BACKTRACK is true and FINDLOOP is false
  74. set FINDLOOP to true
  75. set BOTTLENECK to false
  76. move any direction (use a default direction, not a random one)
  77. continue main loop
  78.  
  79.  
  80. ##############################
  81. how to move according to boundaries: (NOTE: "right" and "left" are always relative to the current direction)
  82. if CUR is filled or the forward-right corner is filled
  83. move CUR one step forward
  84. turn to next direction
  85. else
  86. if MARK is at the pixel one step forward
  87. * set CUR to MARK's direction and location
  88. * set remove MARK and MARK2
  89. * set BACKTRACK to false
  90. * set FINDLOOP to false
  91. * get the new boundaries and restart the move routine from the beginning
  92. else, if MARK2 is at the pixel one step forward
  93. set MARK to MARK2's direction and location
  94. set CUR's direction to MARK2's direction
  95. remove MARK2
  96. if BACKTRACK is true and FINDLOOP is false
  97. if either the pixel two steps forward is filled or the forward-left side pixel is filled
  98. set FINDLOOP to true
  99. move CUR one step forward
  100. move CUR one step to the right
  101. turn to next direction
  102.  
  103.  
  104.  
  105. ##############################
  106. How to turn to the next direction:
  107. if no boundaries are filled, just face in the default direction and stop turning
  108. while the pixel to the right is not filled
  109. rotate to the right
  110. while the pixel to the front is filled
  111. rotate to the left
  112.  
  113.  
  114.  
  115. ##############################
  116. every time you paint:
  117. remove MARK, if set
  118. remove MARK2, if set
  119. set FINDLOOP to false
  120. set BOTTLENECK to false
  121. set RULE to "right"
Add Comment
Please, Sign In to add comment