Log In  


Cart #tweetcart-2 | 2023-05-06 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8

Watch and be amazed :)

It was really fun to optimize the code to its limit.

You can just paste this in pico-8.
here is the code:(space is only included in this post)

i=line::h::n=t()/3x=cos(n)*40y=sin(n)*40q=128p=63u=-abs(x)/10for z=0,3do
j=z%2*q
k=z\2*q
i(j,k,x+p,y+p,u)i(j,k,p-x,p-y,u-1)i(j,k,p-x,y+p,u)i(j,k,x+p,p-y,u-1)end
for i=1,999do
pset(rnd(q),rnd(q),0)end
flip()goto h

Im not sure if I can compress it any further, but if you
see anything please comment it.

8


Really nice!

I think this cuts about 40 characters off the minified code:

i=line::h::n=t()/3x=cos(n)*40y=sin(n)*40q=128p=63u=-abs(x)/10for z=0,3do
j=z%2*q
k=z\2*q
i(j,k,x+p,y+p,u)i(j,k,p-x,p-y,u-1)i(j,k,p-x,y+p,u)i(j,k,x+p,p-y,u-1)end
for i=1,999do
pset(rnd(q),rnd(q),0)end
flip()goto h

A few things I did:

  • Combined for loops
  • Changed how time was tracked (kept time scale about the same though)
  • Inlined or got rid of unnecessary constants and computations - l could be replaced with unary negation, o was only used once and so took fewer chars to inline, etc.
  • After doing the above, rearranged some things to require less whitespace

I think it's very likely more could be done: I probably missed some things, and I haven't really tried to understand the code in a way that would enable deep changes.


hey, this is pretty cool!
plus luchaks's code is so small that it maybe will work


1

thanks, glad you like it.
Also thanks to Luchaks for helping me out with the code.


guess who? ;)


Aren't You THE STEAMIST !!???
The Gamedev from Youtube.



[Please log in to post a comment]