Skip to content

Instantly share code, notes, and snippets.

@RYSF13
Last active April 12, 2026 12:22
Show Gist options
  • Select an option

  • Save RYSF13/9340c61d7a25da4eb937aac060963321 to your computer and use it in GitHub Desktop.

Select an option

Save RYSF13/9340c61d7a25da4eb937aac060963321 to your computer and use it in GitHub Desktop.
rendering a blackhole in 4 lines
// blackhole.c - rendering blackhole in 4 lines
float R,o,b,e,r,t/*Y.Stanford*/;main(_){for(o=-10;++o<10;puts("")
)for(R=-31;++R<30;)b=R*.98-o*.2,e=o*.98+R*.2,t=hypot(R,2*o)-7,r=(
.65+.35*cos(atan2(2*o,R)-.2))/exp(t*t),t=b*b<225?(.65+b*.023)/exp
(e*e/.3):0,putchar(" .,-~+*#"[_=((r=t>r?t:r)>1?7:r*7)]);}//rysf13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment