I’ve made the source code for draw-something more readable and modular, ready for the next round of development. So code that read like this:
(defmethod draw-around ((poly polyline) (han hand)) "Draw around a polygon using a hand." (let* ((the-hand (start-drawing poly han)) (first-point (location han)) (sketch (list first-point))) ;;Make the rest, finishing when (length sketch) 2) (
now reads more like this (in part):(defmethod ensure-next-pen-close-enough ((poly polyline) (p pen)) "If the pen would move too far next time, turn it right until it wouldn't." (while (next-pen-too-far poly p) (turn-right p (turn-step p)))) (defmethod adjust-next-pen ((poly polyline) (p pen)) "Set the pen back on the correct path around the shape." (ensure-next-pen-far-enough poly p) (ensure-next-pen-close-enough poly p)) (defmethod draw-step ((poly polyline) (p pen)) "Find the next point forward along the drawn outline of the shape." (adjust-next-pen poly p) (move-forward p (speed p)) (location p))
Which is much easier to understand and work with. Next up is a "probabilistic pen" if I can get that to work, and a simple colouring algorithm.