Skip to content

Instantly share code, notes, and snippets.

@RYSF13
Created February 26, 2026 13:07
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.
render a blackhole in 4 lines
float R,o,b,e,r,t/*Y.Stanford*/;main(){for(o=-11;++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=exp(-t*t)*
(.65+.35*cos(atan2(2*o,R)-.2)),t=fabs(b)<15?exp(-e*e/.3)*(.65+b*.023)
:0,putchar("#*+~-,. "[(int)((r=t>r?t:r)>1?7:r*7)]);}// rysf13@qq.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment