I guess I managed to obfuscate a lot of code. And with only the effect I was in 12 lines iirc. I had no inspiration for additional effects. At first I decided to call for music playing so that I intentionally reach 20 lines. But still I managed to obfuscrate the music init code too. So even if I am only at 14 lines I decided to stop here with this. Sorry, I never have motivation to fill those lines or those bytes left in size coding compos
It shows that much more can be done in 20 lines. And I was even too lazy to improve!
#include "tinyptc.bi"
#include "fmod.bi"
if ptc_open( "20 lines Optytro 3", 320, 240) then dim shared buffer(320*240) as integer
if FSOUND_Init(48000, 8, 0) then FMUSIC_PlaySong (FMUSIC_LoadSong ("contraduct_design.xm"))
do
l! = timer * 64.0
for y%=-120 to 119
for x%=-160 to 159
k! = sqr((10240 + sin(l!/32.0)*6144)- x%*x% - y%*y%)/256.0
if k!>0.1 then buffer((y%+120) * 320 + x% + 160) = (((((x%/k! + l!*8) AND (y%/k! + l!*8)) AND 255)) SHL 16) OR ((sqr(x%*x%+y%*y%)) AND 255) else buffer((y%+120) * 320 + x% + 160) = ((sin((sin(x%/45) * 41263 + sin((y% + l!*2)/45) * 65446 + sin((x% + sin((y% + l!*1)/64) * 256)/67) * 36676 + sin((x% + y% + y%)/127) * 7896)/4096) * 127 + 128) SHL 16) OR (((x%+160) SHR 1) SHL 8) OR (y% + 120)
next x%
next y%
ptc_update@buffer(0)
loop until inkey$<>""
Goodnight..
p.s. Music by the hardliner btw.
p.p.s. I could obfuscrate more but it started being too slow. E.g. I made a test where I removed X, Y loops, inserted a For i=0 to 320*240-1 loop, and in all the big line with maths, I changed X with ((i mod 320) - 160) and Y with ((i \ 320) - 120). Crazy!!! But I decided to not put this here because it made the code even more slow and I already had more than enough lines anyways..
p.p.p.s. External files are allowed eh? Like fmod.dll and a music. Or not? I've seen somewhere that they are allowed..
p.p.p.p.s. And it still impresses me that by using FPU in such a crazy way with so many calcs per pixel (at least for small resolutions) can still have an ok speed. Not the way I knew to optimize things in quickbasic