src/robots/bit-loom.lisp @ 26d560b85b8a
Fucking make
author |
Steve Losh <steve@stevelosh.com> |
date |
Sat, 03 Feb 2018 16:07:49 -0500 |
parents |
af9390b6947b |
children |
203fa16acf7a |
(in-package :magitek.robots.bit-loom)
(defun pnm-to-png (pnm png)
(sb-ext:run-program "pnmtopng" (list pnm)
:search t
:output png
:error *standard-output*
:if-output-exists :supersede)
(sb-ext:run-program "mogrify" (list "-resize" "800x800" png)
:error :output
:search t))
(defun loom-1 (seed)
(let ((depth (random-range-inclusive 16 19)))
(flax.looms.001-triangles:loom seed depth "out.pnm" 3000 3000)
`(depth ,depth)))
(defun generate-image (seed)
(prog1 (loom-1 seed)
(pnm-to-png "out.pnm" "out.png")))
(defun random-tweet ()
(let* ((seed (random (expt 2 32)))
(parameters (append `(seed ,seed) (generate-image seed))))
(values (string-upcase (format nil "Loom ~R, ~{~A ~A~^, ~}" 1 parameters))
"out.png")))