Seeking

This took a ridiculous amount of time to hack together, but here’s a Common Lisp function to decide the shortest angle between two other angles. It’s used in the example of seeking a point above. I can now add noise to this to make a more AARON-style pen.

```(defun shortest-angle-difference (a1 a2)
"Find the shortest positive or negative distance between two angles."
;; This was slowly assembled from various online sources, none of which worked
;; Normalize angles to 0..2pi
(let ((from (mod a1 +radian+))
(to (mod a2 +radian+)))
;; If from and to are equal (0 = 2pi radians) the angle is zero
(if (or (= from to)
(= (+ from to) +radian+))
0.0d0
(let ((angle (- to from)))
(if (> (abs angle) pi)
;; Please simplify me
(* (- (signum angle)) (- +radian+ (abs angle)))
angle)))))
```
draw-something 2016

I’ve updated the Common Lisp version of draw-something to use modern technologies – Roswell, QuickLisp, ASDF 3, cl-cffi-gtk and the Plan testing library. The tests helped flush out bugs, changing my mis-uses of defmethod to defun silenced a lot of compiler warnings and that in turn helped find some more bugs. There’s now a bit of technical debt in the form of function and class names, I’ll address that later. Like the recent minara update, this is a bitrot update rather than a new feature release.

Running the code to test it reminded me of just how dissatisfied I was with the last version of draw-something. The image at the top of this post is one of the less bad results of running the code. This is an aesthetic / theoretic problem rather than a coding one. I need the same clarity that informed the earlier versions of the program (you can see a JavaScript version of one running on tumblr) in order to structure the code to output something you’d actually want to look at.