Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BACKTRACK is false
- FINDLOOP is false
- BOTTLENECK is false
- CUR is the current pixel
- MARK is the first mark, and is not set
- MARK2 is the second mark, and is not set
- Start by turning to face the next direction
- main loop:
- if CUR is bound by 4 edge pixels
- paint CUR
- all possible pixels have been filled, so exit the routine
- if CUR is bound by 3 edge pixels
- paint CUR
- move forward
- turn to next direction
- continue main loop
- if CUR is bound by 2 edge pixels
- if the two bounding edge pixels are not across from each other, and the corner opposite both edge pixels is not filled
- paint CUR
- move forward
- turn to next direction
- continue main loop
- else
- if BACKTRACK is false and MARK is not set
- set MARK to CUR's location and direction
- set FINDLOOP to false
- else, if MARK is set
- if MARK2 is not set
- if CUR is at MARK's location
- if CUR's direction is the same as MARK's
- remove MARK
- set BACKTRACK to false
- else
- set BACKTRACK to true
- set CUR to MARK's direction
- set FINDLOOP to false
- else, if FINDLOOP is true
- set MARK2 to CUR's location and direction
- else
- if CUR is at MARK's location
- set CUR to MARK2's direction and location
- remove MARK
- remove MARK2
- set BACKTRACK to false
- else if CUR is at MARK2's location
- set MARK to MARK2's direction and location
- set CUR's direction to MARK2's direction
- remove MARK2
- if BACKTRACK is false and MARK is not set
- if BOTTLENECK is false
- paint CUR
- set BOTTLENECK to false
- move according to boundaries
- continue main loop
- if CUR is bound by 1 edge pixel
- if BACKTRACK is true and FINDLOOP is false
- set FINDLOOP to true
- else, if neither of the corners opposite the bounding pixel are filled
- paint CUR
- move forward
- turn to next direction
- continue main loop
- move according to boundaries
- continue main loop
- if CUR is bound by 0 edge pixels
- if BACKTRACK is true and FINDLOOP is false
- set FINDLOOP to true
- set BOTTLENECK to false
- move any direction (use a default direction, not a random one)
- continue main loop
- ##############################
- how to move according to boundaries: (NOTE: "right" and "left" are always relative to the current direction)
- if CUR is filled or the forward-right corner is filled
- move CUR one step forward
- turn to next direction
- else
- if MARK is at the pixel one step forward
- * set CUR to MARK's direction and location
- * set remove MARK and MARK2
- * set BACKTRACK to false
- * set FINDLOOP to false
- * get the new boundaries and restart the move routine from the beginning
- else, if MARK2 is at the pixel one step forward
- set MARK to MARK2's direction and location
- set CUR's direction to MARK2's direction
- remove MARK2
- if BACKTRACK is true and FINDLOOP is false
- if either the pixel two steps forward is filled or the forward-left side pixel is filled
- set FINDLOOP to true
- move CUR one step forward
- move CUR one step to the right
- turn to next direction
- ##############################
- How to turn to the next direction:
- if no boundaries are filled, just face in the default direction and stop turning
- while the pixel to the right is not filled
- rotate to the right
- while the pixel to the front is filled
- rotate to the left
- ##############################
- every time you paint:
- remove MARK, if set
- remove MARK2, if set
- set FINDLOOP to false
- set BOTTLENECK to false
- set RULE to "right"
Add Comment
Please, Sign In to add comment