Dark Bit Factory & Gravity

PROGRAMMING => Purebasic => Topic started by: va!n on June 16, 2009

Title: PurePunch Contest #2 - FlipFrac
Post by: va!n on June 16, 2009
This is just my small and fast contribution for a contest on the purebasic community...


Windows Version (Exit by pressing ESCAPE):

;*****************************************************************************
;*
;* Name   : FlipFrac - flipping flat fractal with faked lightsourcing effect                              
;* Author : Thorsten Will - aka 'Mr.Vain of Secretly!'
;* Date   : 16.06.2009                                    
;* Notes  : Entry for the PurePunch Contest #2
;*          The rule is to code something in max 10 lines of 80 characters!
;*          I did a small graphic effect in just only 5 lines of code! ;-)
;*          Win32 API has been used to check if user pressed the ESCAPE key
;*
;*****************************************************************************  
InitSprite():OpenScreen(640,480,32,""):b=255:Repeat:StartDrawing(ScreenOutput())
For m=0 To 639:For n=0 To 479:c=(64+Random(128))<<16:p.f=(m-320)/(Sin(t.f)*200)
q.f=(n-240)/(Cos(t)*200):x.f=0:y.f=0:For i=0 To 31:u.d=x*x-y*y+p:v.d=2*x*y+q
If(u*u+v*v)>4:Goto E:EndIf:x=u:y=v:Next:c=Cos(t)*200:c=RGB(c,c,b):E:Plot(m,n,c)
Next:Next:StopDrawing():t+0.05:FlipBuffers():Until GetAsyncKeyState_(27):End



Cross Platform Version (automatical exit after some seconds, just change Until t>10] value):

;*****************************************************************************
;*
;* Name   : FlipFrac - flipping flat fractal with faked lightsourcing effect                              
;* Author : Thorsten Will - aka 'Mr.Vain of Secretly!'
;* Date   : 16.06.2009                                    
;* Notes  : Entry for the PurePunch Contest #2
;*          The rule is to code something in max 10 lines of 80 characters!
;*          I did a small graphic effect in just only 5 lines of code! ;-)
;*          Exit automatical after some seconds to fit still into 5 lines of code
;*
;*****************************************************************************  
InitSprite():OpenScreen(640,480,32,""):b=255:Repeat:StartDrawing(ScreenOutput())
For m=0 To 639:For n=0 To 479:c=(64+Random(128))<<16:p.f=(m-320)/(Sin(t.f)*200)
q.f=(n-240)/(Cos(t)*200):x.f=0:y.f=0:For i=0 To 31:u.d=x*x-y*y+p:v.d=2*x*y+q
If(u*u+v*v)>4:Goto E:EndIf:x=u:y=v:Next:c=Cos(t)*200:c=RGB(c,c,b):E:Plot(m,n,c)
Next:Next:StopDrawing():t+0.05:FlipBuffers():Until t>10:End



Attached compiled Win32 version
Title: Re: FlipFrac
Post by: Shockwave on June 16, 2009
It runs pretty quick for obfurscated code.
Nice one va!n :)
Title: Re: FlipFrac
Post by: ferris on June 16, 2009
Heh better than I expected from that small segment :D
Title: Re: FlipFrac
Post by: benny! on June 17, 2009
N1, good luck with this in the competition!
Title: Re: FlipFrac
Post by: Clyde on June 18, 2009
Yeah, hope you do well dude.
Is your group called Secretly, Mr Vain ?
Title: Re: FlipFrac
Post by: va!n on June 18, 2009
thx for feedback...

@Clyde:
yes... me is called "mr.vain of secretly!" (groupname with exclamation mark ^^)