Commit ba00c9a6 authored by Adrian Kosmaczewski's avatar Adrian Kosmaczewski

First full working version

parent ddb410af
......@@ -56,6 +56,36 @@
(format t "~%"))))
(defun make-blinker (origin)
(list (make-coord :x (coord-x origin) :y (coord-y origin))
(list (make-coord :x (coord-x origin) :y (coord-y origin))
(make-coord :x (+ 1 (coord-x origin)) :y (coord-y origin))
(make-coord :x (+ 2 (coord-x origin)) :y (coord-y origin))))
(defun make-beacon (origin)
(list (make-coord :x (coord-x origin) :y (coord-y origin))
(make-coord :x (+ 1 (coord-x origin)) :y (coord-y origin))
(make-coord :x (coord-x origin) :y (+ 1 (coord-y origin)))
(make-coord :x (+ 1 (coord-x origin)) :y (+ 1 (coord-y origin)))
(make-coord :x (+ 2 (coord-x origin)) :y (+ 2 (coord-y origin)))
(make-coord :x (+ 3 (coord-x origin)) :y (+ 2 (coord-y origin)))
(make-coord :x (+ 2 (coord-x origin)) :y (+ 3 (coord-y origin)))
(make-coord :x (+ 3 (coord-x origin)) :y (+ 3 (coord-y origin)))))
(defun make-glider (origin)
(list (make-coord :x (+ 2 (coord-x origin)) :y (+ 2 (coord-y origin)))
(make-coord :x (+ 1 (coord-x origin)) :y (+ 2 (coord-y origin)))
(make-coord :x (coord-x origin) :y (+ 2 (coord-y origin)))
(make-coord :x (+ 2 (coord-x origin)) :y (+ 1 (coord-y origin)))
(make-coord :x (+ 1 (coord-x origin)) :y (coord-y origin))))
(defun make-block (origin)
(list (make-coord :x (coord-x origin) :y (coord-y origin))
(make-coord :x (+ 1 (coord-x origin)) :y (coord-y origin))
(make-coord :x (coord-x origin) :y (+ 1 (coord-y origin)))
(make-coord :x (+ 1 (coord-x origin)) :y (+ 1 (coord-y origin)))))
(defun make-tub (origin)
(list (make-coord :x (+ 1 (coord-x origin)) :y (coord-y origin))
(make-coord :x (coord-x origin) :y (+ 1 (coord-y origin)))
(make-coord :x (+ 2 (coord-x origin)) :y (+ 1 (coord-y origin)))
(make-coord :x (+ 1 (coord-x origin)) :y (+ 2 (coord-y origin)))))
......@@ -6,7 +6,12 @@
(format t "~C[2J" #\Esc))
(defvar alive-cells (make-blinker (make-coord :x 0 :y 1)))
(defvar world (make-world 5 alive-cells))
(setq alive-cells (append (make-beacon (make-coord :x 10 :y 10)) alive-cells))
(setq alive-cells (append (make-glider (make-coord :x 4 :y 5)) alive-cells))
(setq alive-cells (append (make-block (make-coord :x 1 :y 10)) alive-cells))
(setq alive-cells (append (make-block (make-coord :x 18 :y 3)) alive-cells))
(setq alive-cells (append (make-tub (make-coord :x 6 :y 1)) alive-cells))
(defvar world (make-world 30 alive-cells))
(defvar generation 1)
(loop
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment