⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ms.lsp

📁 基因演算法source code範例vc
💻 LSP
字号:
(defun MS (x y plotnum)
  (system::graph-init)
  (system::graph-clear)
  (system::graph-show)
  (let ((tx 0)(ty 0)
	(halfnum (/ plotnum 2))
	(z (complex 0 0)))
     (dotimes (i plotnum 'X-axis)
       (setf tx	(- (/ i	halfnum) 1))
	 (dotimes (j plotnum 'Y-axis)
	   (setf ty (- (/ j halfnum) 1))
	   (setf z (complex (float tx) (float ty)))
	   (let	((color	nil))
		(dotimes (k 50 'Iteration)
		   (setf z (+ (complex tx ty) (* z z)))
		   (setf color k)
		   (let	((rz (float (realpart z)))
			 (iz (float (imagpart z))))
		    (setf z (complex rz	iz))
		   ;(print `(z=,z rz=,rz iz=,iz))
		    (if	(> (+ (* rz rz)(* iz iz)) 4)
			(setf k	1000)
			()
		    )))
		(system::graph-dot (+ x	i) (+ y	j) (mod	color 15))
	      ;	(print `(i=,i j=,j color=,color))
	   )
	 )
     )
  )
  (read-char *keyboard-input*)
)

(defun MS2 (inx	iny len	plotnum)
  (system::graph-init)
  (system::graph-clear)
  (system::graph-show)
  (let ((tx 0)(ty 0)
	(z (complex 0 0)))
     (dotimes (i plotnum 'X-axis)
       (setf tx	(+ inx (* len (/ i plotnum))))
	 (dotimes (j plotnum 'Y-axis)
	   (setf ty (+ iny (* len (/ j plotnum))))
	   (setf z (complex (float tx) (float ty)))
	   (let	((color	nil))
		(dotimes (k 50 'Iteration)
		   (setf z (+ (complex tx ty) (* z z #c(1.3 3.4))))
		   (setf color k)
		   (let	((rz (float (realpart z)))
			 (iz (float (imagpart z))))
		    (setf z (complex rz	iz))
		   ;(print `(z=,z rz=,rz iz=,iz))
		    (if	(> (+ (* rz rz)(* iz iz)) 4)
			(setf k	1000)
			()
		    )))
		(system::graph-dot (+ 10 i) (+ 10 j) (mod color	15))
	      ;	(print `(i=,i j=,j color=,color))
	   )
	 )
     )
  )
  (read-char *keyboard-input*)
)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -