Skip to content

Instantly share code, notes, and snippets.

@houmei
Last active June 28, 2024 12:09
Show Gist options
  • Save houmei/2e6785b7aea0166880dddf935c1c31c1 to your computer and use it in GitHub Desktop.
Save houmei/2e6785b7aea0166880dddf935c1c31c1 to your computer and use it in GitHub Desktop.
AI-1000 hat demonstration
(defun hat ()
(angle 0) ; degree
(clear-screen)
(setq d (make-array 192))
(do ((i 0 (1+ i))) ((= i 191) i) (setf (aref d i) 100))
; (setq rd (/ 3.14 180))
(draw 0 0)
(do ((y -180 (+ y 18))) ((<= 180 y) t) ; step 6
(do ((x -180 (+ x 12))) ((<= 180 x) t) ; step 4
(setf r (sqrt (+ (* x x)(* y y))))
(setf z (- (* 100 (cos r)) (* 30 (cos (* 3 r)))))
(setf sx (truncate (+ 96 (/ x 3) (/ y -6))))
(setf sy (truncate (+ 40 (/ y -6) (/ z -4))))
(when (> (aref d sx) sy)
(setf (aref d sx) sy)
; (set-cursor 0 0)(princ sx)(print sy)
(draw sx (/ sy 3))) ; 192x64dot
)
)
(drawc 0 0)
(loop)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment