Strict Standards: Non-static method Soojung::addReferer() should not be called statically in /home/lifthrasiir/sites/sapzil.info/soojung/settings.php on line 79

Warning: Cannot modify header information - headers already sent by (output started at /home/lifthrasiir/sites/sapzil.info/soojung/settings.php:79) in /home/lifthrasiir/sites/sapzil.info/soojung/classes/Counter.class.php on line 63

Strict Standards: Non-static method Entry::getEntry() should not be called statically in /home/lifthrasiir/sites/sapzil.info/soojung/entry.php on line 51

Strict Standards: Non-static method Soojung::entryIdToFilename() should not be called statically in /home/lifthrasiir/sites/sapzil.info/soojung/classes/Entry.class.php on line 182

Strict Standards: Non-static method Soojung::queryFilenameMatch() should not be called statically in /home/lifthrasiir/sites/sapzil.info/soojung/classes/Soojung.class.php on line 55
TokigunStudio3 | 블로그: 프랙탈 나무

내용으로 바로 넘어 가기


TokigunStudio3

228 / 3282   


더 이상 이 블로그는 운영되지 않습니다. 새 블로그로 가 주세요.

프랙탈 나무

2005/03/17 PM 10:03 | 개발/obfuscation | 6 comments | 0 trackbacks | AllBlog: vote, to pocket

한 달 반만에 나온 새 작품. (사실 angolmois 가지고 삽질하다가 시간 없어서 중단 상태였...) 아래의 파이썬 프로그램은 pygame을 써서 랜덤한 나무 이미지를 보여 준다. 계절 별로 색깔이 바뀌는 기능이 있고, 계속 보면 예쁘다 :)
def d(n,x,l,t):y=x[0]+l*math.sin(t),x[1]+l*math.cos(t);draw.aaline(c,(a[
u]+a[u+1]*n,a[u+2]+a[u+3]*n,a[u+4]),x,y);r=random.random;(display.flip()
,event.poll());n and[d(n-1,y,l*(.7+r()/5),t+i*r())for i in(-1,1)];2005.3
from pygame import*;import math,random,time;c=display.set_mode((800,600)
);u=time.localtime()[1]%12/3*5;s='winter','spring','summer','autumn';a=(
30,2.5,30,1,30,20,1.5,30,-.5,10,10,2,30,-.5,10,30,1,30,-.5,10);p=math.pi
while 1:c.fill((0,0,16));display.set_caption("tree: "+s[u/5]);draw.rect(
c,(32,)*3,(0,550,800,50));d(17,(400,550),100,p);u=(u+5)%20;time.sleep(3)
"Created by Kang Seonghoon <tokigun@gmail.com>; License: GNU LGPL ver 2"
너무 느리게 출력된다 싶으면 (이건 win32에서만 테스트했는데...) 출력 중인 창을 다른 큰 창 뒤에 완전히 숨겨서 화면 갱신을 안 하도록 하면 무진장 빨라진다. (그리는 속도가 10배가 된다. -_-)

자세한 것은 obfuscation collection을 참고하는 것이 좋겠다. (스크린샷 드디어 올렸음 -_-;;;)

TrackBack URL: http://sapzil.info/soojung/trackback.php?blogid=539

Comment: d3m3vilurr (2005/03/17 PM 11:11)

멋져요! :)

Comment: 토끼군 (2005/03/17 PM 11:15)

d3m3vilurr: 잇힝! =3=33 pygame의 blend 알고리즘이 제가 생각하던 거랑 달라서 좀 고생했습니다. (결국에는 숫자를 직접 하나 하나 고쳐 가면서 괜찮은 색깔을 찾아 냈음 -_-)

Comment: daybreaker (2005/03/18 AM 10:59)

다른 건 다 토끼스럽다고 해도 이것만큼은 멋지구나! -_-;;

Comment: 토끼군 (2005/03/18 AM 11:09)

daybreaker: ...근데 저게 24비트 아래에서는 안 돌아 간다. 좀 고쳐야 함. orz

Comment: FrogLamb (2005/03/18 AM 11:09)

냠... 털보씨로 한번 짜본적이 있는 프로그램~_~
일정 depth아래에서는 갈색으로 하고 굵기를 depth별로 조정한 담에 depth가 좀 깊어지면 초록색으로 바꿨더니 그럭저럭 나무 모양이 나오더군요

Comment: 토끼군 (2005/03/18 AM 11:12)

FrogLamb: 옛날에 많이 짜던 프로그램이죠. 색깔 주는 방법을 다르게 하면 재밌는 게 많이 나와요.

Copyright (c) 1995-2005, Kang Seonghoon (Tokigun).