Twitter Genetic Algorithm Imagery

栏目: IT技术 · 发布时间: 4年前

内容简介:A Clojure library designed to breed images via twitter. Now running on Heroku.SeeEach tweet has a name based on the timestamp of creation with a suffix at the end, a link to a github gist and a hashtag (currently #ProceduralArt).

tweegeemee (트의기미)

A Clojure library designed to breed images via twitter. Now running on Heroku.

See https://twitter.com/tweegeemee/media for the latest images.

Each tweet has a name based on the timestamp of creation with a suffix at the end, a link to a github gist and a hashtag (currently #ProceduralArt).

The link to a github gist highlights the code used to create the image.

Follow, Favorite and Retweet tweegeemee images to select them for future generations.

Currently posting a set of two new images every hour. The suffix at the end of the image name tells you generation-type: a,b are random; C,D are sexually reproduced and M,N are mutants with only one parent.

For reproduction, the last 200 tweets are considered. The top 5 are allowed to produce offspring.

Oh, what is "트의기미"? That is the Korean (Hangul) characters for twee (트의) gee (기) mee (미). I believe it is just a nonsense word and liked the look of it.

Let's see where this goes...

Background

A while back, I saw Carin Meier's "How I Start" post about running a Clojure-based twitter bot on Heroku. She showed how easy it was to get this working, I was intrigued and decided I'd like to give it a try--but with my own twist.

In the back of my mind, something I've always wanted to do was experiment with image generation via lisp s-expressions as Karl Sims did in his '91 Siggraph paper . But, how to decide what constitutes a "good" image to breed? Well, how about using Twitter retweets and favorites for scoring?

I found the Clisk clojure image library was perfect for recreating Sims' imagery. I also took some inspriration from https://github.com/nodename/clevolution , http://www.thattommyhall.com/2013/08/23/genetic-programming-in-clojure-with-zippers/ and http://blog.raynes.me/blog/2011/12/02/waving-our-tentacles/ .

So far, this has been quite fun to work on.

Usage

You should be able to clone/fork this library, follow the "How I Start" post and get this running on Heroku. Note that as of version 1.3, due to Heroku free dynos now requiring 6 hours of sleep in a 24 hour period, I switched to using the Scheduler add-on. See Issue 11 for more information.

If you just want to create & breed your own imagery, see the bottom of core.clj for snippets to generate & show a random image, breed images by hand and mutate images.

Making your own images

Perhaps you'd like to reproduce one of the images posted? Maybe, you want a desktop background or something like that?

First, click that tweet's link to go to the github gist data structure. For example,

{ :name "150613_061332_D.clj" :hash -504503564 :image-hash -1696445894
   :code (clisk.live/vdivide (clisk.live/vfrac (clisk.live/vmin (clisk.live/v+ (clisk.live/alpha clisk.live/grain) [-0.9438 0.4027 2.3753 1.7962]) (clisk.live/sigmoid (clisk.live/vfloor [0.4416 -2.6627 -1.6566])))) (clisk.live/gradient (clisk.live/square (clisk.live/v- [-0.2226 -2.2105 -2.7124 -1.7799] clisk.live/vsnoise))))
 }

Second, copy the info after the :code keyword to the end of the line. e.g. (clisk.live/vdivide ... )

Next, load up a repl and paste the clipboard contents in to define a variable code after a (important!) single quote like so:

=> (def code '(clisk.live/vdivide (clisk.live/vfrac (clisk.live/vmin (clisk.live/v+ (clisk.live/alpha clisk.live/grain) [-0.9438 0.4027 2.3753 1.7962]) (clisk.live/sigmoid (clisk.live/vfloor [0.4416 -2.6627 -1.6566])))) (clisk.live/gradient (clisk.live/square (clisk.live/v- [-0.2226 -2.2105 -2.7124 -1.7799] clisk.live/vsnoise))))
   )
=> (show (eval code) :width 720 :height 720)

To save an image, do

(write-png "nice_one.png" (image (eval code) :width 720 :height 720))

License

Copyright © 2015-2020 Roger Allen

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.


以上所述就是小编给大家介绍的《Twitter Genetic Algorithm Imagery》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

《Unity3D网络游戏实战(第2版)》

《Unity3D网络游戏实战(第2版)》

罗培羽 / 机械工业出版社 / 2019-1-1 / 89.00元

详解Socket编程,搭建稳健的网络框架;解决网游中常见的卡顿、频繁掉线等问题;探求适宜的实时同步算法。完整的多人对战游戏案例,揭秘登录注册、游戏大厅、战斗系统等模块的实现细节。 想要制作当今热门的网络游戏,特别是开发手机网络游戏,或者想要到游戏公司求职,都需要深入了解网络游戏的开发技术。本书分为三大部分,揭示网络游戏开发的细节。 第一部分“扎基础”(1-5章) 介绍TCP网络游......一起来看看 《《Unity3D网络游戏实战(第2版)》》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

SHA 加密
SHA 加密

SHA 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具