Created
April 24, 2012 04:16
-
-
Save youz/2476357 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; http://www.p01.org/releases/#128b_raytraced_checkboard | |
(defun draw-checkboard (n &optional (s *standard-output*)) | |
(do* ((k 64) (i k)) | |
((= (decf i (/ k)) 0)) | |
(let ((j (/ k i))) | |
(princ (char "p.\n" | |
(if (and (integerp i) (evenp i)) | |
2 | |
(logand 1 | |
(logxor (floor j) | |
(floor (+ (* (mod i 2) j) (- j) (/ n k))))))) | |
s)))) | |
(defun checkboard () | |
(interactive) | |
(let ((n 0) (buf (get-buffer-create "*check*"))) | |
(labels ((frame () | |
(if (eq *this-command* 'quit) | |
#1=(progn | |
(stop-timer #'frame) | |
(delete-buffer buf) | |
(refresh-screen)) | |
(handler-case | |
(progn | |
(set-buffer buf) | |
(erase-buffer buf) | |
(with-output-to-buffer (buf) | |
(draw-checkboard (incf n 7))) | |
(refresh-screen)) | |
(quit (c) #1#))))) | |
(start-timer 1/30 #'frame)))) | |
; press C-g to stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
こんにちは!
29行目 draw-scene ではなく draw-checkboard でしょうか?