-*** performance -- ‘compare-strings’ approach too clever/slow :-/
-* debugging aids
-*** swizzling branches for frolicking fun
-(defun SWIZ (a b)
- (let* ((tree (gnugo-get :sgf-gametree))
- (monkey (gnugo-get :monkey))
- (bidx (aref monkey 1)))
- (rotatef (aref tree a)
- (aref tree b))
- (cond ((= a bidx) (aset monkey 1 b))
- ((= b bidx) (aset monkey 1 a)))))
-
-(defun SWIZ-RANDOM ()
- (interactive)
- (let* ((n (length (gnugo-get :sgf-gametree)))
- (one (random n))
- (two (if (= 1 n)
- one
- (loop with try
- while (= one (setq try (random n)))
- finally return try))))
- (SWIZ one two)
- (message "%d <-> %d" one two)))
-
-(defun UNSWIZ ()
- (interactive)
- (let* ((monkey (gnugo-get :monkey))
- (cur (aref monkey 1)))
- (if (zerop cur)
- (message "(nothing to do)")
- (SWIZ 0 cur)
- (message "0 <-> %d" cur))))