POV-Ray : Newsgroups : povray.general : Stupid SDL tricks: Self-replicating scene file Server Time
29 Nov 2024 17:53:53 EST (-0500)
  Stupid SDL tricks: Self-replicating scene file (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: PM 2Ring
Subject: Stupid SDL tricks: Self-replicating scene file
Date: 20 Jul 2005 09:20:00
Message: <web.42de4f68a8c8ae5b9ca540650@news.povray.org>
// SelfPrint.pov by PM 2Ring. 2005.5.16
// +A0.01 +AM2 +R4
camera{location -42*z}background{rgb .25}
#declare U=-26;#declare V=19;#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

#declare T=array[20]{
"// SelfPrint.pov by PM 2Ring. 2005.5.16                        ",
"// +A0.01 +AM2 +R4                                             ",
"camera{location -42*z}background{rgb .25}                      ",
"#declare U=-26;#declare V=19;#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        ",
"                                                               ",
"#declare T=array[20]{                                          ",
"};w(0,17)q(0,20)w(17,20)                                       ",
"                                                               ",
"//--------------------End of scene-------------------------    ",
};w(0,17)q(0,20)w(17,20)

//--------------------End of scene-------------------------


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Stupid SDL tricks: Self-replicating scene file
Date: 20 Jul 2005 15:33:32
Message: <42dea70c@news.povray.org>
what do you need that for???


Post a reply to this message

From: Slime
Subject: Re: Stupid SDL tricks: Self-replicating scene file
Date: 20 Jul 2005 16:44:04
Message: <42deb794$1@news.povray.org>
> what do you need that for???

In case you ever need a self-replicating scene file, that can produce one
for you.

Duh!

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: PM 2Ring
Subject: Re: Stupid SDL tricks: Self-replicating scene file
Date: 21 Jul 2005 05:00:00
Message: <web.42df62dd72a760c1ca0fcbad0@news.povray.org>
"Nicolas Alvarez" <nic### [at] gmailbestwebmailcom> wrote:
> what do you need that for???

Need? Who said anything about need? :) I did warn you that it was a Stupid
SDL trick. :)

It's an old hacker's tradition to write a program that reproduces its own
source code. I'm just showing that the POV SDL is powerful enough to do
this.


Post a reply to this message

From: B  Gimeno
Subject: Re: Stupid SDL tricks: Self-replicating scene file
Date: 21 Jul 2005 09:30:18
Message: <42dfa36a@news.povray.org>
uh?

File Context (5 lines):
"                                                               ",
"#macro p(s)object{text{ttf "crystal
Parse Error: Cannot assign uninitialized identifier.

--
light_source{0,1}#macro C(r,p)cylinder{x*-2,x*2,.9 pigment { rgb
p} /* B Gimeno estoeslarealidad */ rotate p*90 } #end difference
{box {-1,1} C(z /* http://usuarios.lycos.es/game2413 */,x)C(x,y)
C(z,z) pigment{rgb 2} rotate 45 translate z*4} // www.povray.org


Post a reply to this message

From: PM 2Ring
Subject: Re: Stupid SDL tricks: Self-replicating scene file
Date: 22 Jul 2005 03:50:01
Message: <web.42e0a2ee72a760c15464b3b50@news.povray.org>
"B. Gimeno" <NO_### [at] lycoses> wrote:
> uh?
>
> File Context (5 lines):
> "                                                               ",
> "#macro p(s)object{text{ttf "crystal
> Parse Error: Cannot assign uninitialized identifier.

The web interface is eating my backslashes! Backslashes have disappeared
from infront of the quote marks around the font name.  Very strange... Try
this version:

// SelfPrint.pov by PM 2Ring. 2005.5.16
// +A0.01 +AM2 +R4
camera{location -42*z}background{rgb .25}
#declare U=-26;#declare V=19;#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

#declare T=array[20]{
"// SelfPrint.pov by PM 2Ring. 2005.5.16                        ",
"// +A0.01 +AM2 +R4                                             ",
"camera{location -42*z}background{rgb .25}                      ",
"#declare U=-26;#declare V=19;#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        ",
"                                                               ",
"#declare T=array[20]{                                          ",
"};w(0,17)q(0,20)w(17,20)                                       ",
"                                                               ",
"//--------------------End of scene-------------------------    ",
};w(0,17)q(0,20)w(17,20)

//--------------------End of scene-------------------------


Post a reply to this message

From: PM 2Ring
Subject: Re: Stupid SDL tricks: Self-replicating scene file
Date: 22 Jul 2005 04:40:00
Message: <web.42e0afa772a760c15464b3b50@news.povray.org>
Ok! The new version works properly. I had to double my backslashes. Is this
a known problem with the Web interface? The following lines show what
happens with small sequences of backslashes. Line 1 has 1 backslash, etc.

1 backslash  test
2 backslashes \ test
3 backslashes \ test
4 backslashes \\ test

FWIW, SelfPrint.pov can be considered an exercise in minimalism: all it
generates is itself. :)


Post a reply to this message

From: Peter Warren
Subject: Re: Stupid SDL tricks: Self-replicating scene file
Date: 23 Jul 2005 07:05:01
Message: <web.42e223f572a760c1cdce5cf50@news.povray.org>
> FWIW, SelfPrint.pov can be considered an exercise in minimalism: all it
> generates is itself. :)

I don't know how Minimal this is but it is definitely
a great Conceptual pov piece. I very much enjoyed. Thanks.


Post a reply to this message

From: Rune
Subject: Re: Stupid SDL tricks: Self-replicating scene file
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

From: Jim Charter
Subject: Re: Stupid SDL tricks: Self-replicating scene file
Date: 23 Jul 2005 13:15:55
Message: <42e27b4b$1@news.povray.org>
Peter Warren wrote:
>>FWIW, SelfPrint.pov can be considered an exercise in minimalism: all it
>>generates is itself. :)
> 
> 
> I don't know how Minimal this is but it is definitely
> a great Conceptual pov piece. I very much enjoyed. Thanks.
> 
> 
> 
> 
It had to be done.  I add my thanks.


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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