POV-Ray : Newsgroups : povray.general : Stupid SDL tricks: Self-replicating scene file : Re: Stupid SDL tricks: Self-replicating scene file Server Time
1 Aug 2024 16:27:38 EDT (-0400)
  Re: Stupid SDL tricks: Self-replicating scene file  
From: Rune
Date: 23 Jul 2005 11:31:15
Message: <42e262c3@news.povray.org>
This is a bit shorter.

// SelfPrint.pov by PM 2Ring and Rune S. Johansen. 2005.7.23
// +A0.01 +AM2 +R4
#macro P(S)#fopen F"ps.tmp"write #write(F,S)#fclose F
#include "ps.tmp"#end #declare T=array[22]{
"// SelfPrint.pov by PM 2Ring and Rune S. Johansen. 2005.7.23   ",
"// +A0.01 +AM2 +R4                                             ",
"#macro P(S)#fopen F\"ps.tmp\"write #write(F,S)#fclose F        ",
"#include \"ps.tmp\"#end #declare T=array[22]{                  ",
"}; #local S=\"\";#local i=7;#while(i<22)                       ",
"#local S=concat(S,T[i]) #local i=i+1;#end P(S)                 ",
"//--------------------End of scene-------------------------    ",
"                                                               ",
"camera{location -31*z}background{rgb .25}                      ",
"#declare U=-20;#declare V=14;#declare Q=chr(34);               ",
"                                                               ",
"#macro p(s)object{text{ttf \"crystal.ttf\",s.1,0}pigment{rgb 1}",
"finish{ambient 1}translate<U,V,0>}#declare V=V-1;#end          ",
"                                                               ",
"#macro r(a)#local b=Q;#local i=1;#while(i<=strlen(a))          ",
"#local c=substr(a,i,1);#if(!strcmp(c,Q))                       ",
"#local b=concat(b,chr(92));#end#local b=concat(b,c);           ",
"#local i=i+1;#end concat(b,Q,chr(44))#end                      ",
"                                                               ",
"#macro w(i,h)#while(i<h)p(T[i])#local i=i+1;#end#end           ",
"#macro q(i,h)#while(i<h)p(r(T[i]))#local i=i+1;#end#end        ",
"w(0,4)q(0,22)w(4,7)                                            ",
}; #local S="";#local i=7;#while(i<22)
#local S=concat(S,T[i]) #local i=i+1;#end P(S)
//--------------------End of scene-------------------------


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.