{"id":18535673,"url":"https://github.com/petercunha/donut","last_synced_at":"2025-04-09T15:32:39.203Z","repository":{"id":44348397,"uuid":"147614338","full_name":"petercunha/Donut","owner":"petercunha","description":":robot: A JavaScript implementation of the infamous \"donut.c\" program","archived":false,"fork":false,"pushed_at":"2023-11-09T19:52:52.000Z","size":10,"stargazers_count":39,"open_issues_count":2,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T07:10:02.914Z","etag":null,"topics":["code-golf","delicious","donuts","javascript","pointless"],"latest_commit_sha":null,"homepage":"https://donut.surge.sh","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petercunha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-06T03:48:09.000Z","updated_at":"2025-03-31T11:18:38.000Z","dependencies_parsed_at":"2023-02-09T09:32:14.669Z","dependency_job_id":null,"html_url":"https://github.com/petercunha/Donut","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petercunha%2FDonut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petercunha%2FDonut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petercunha%2FDonut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petercunha%2FDonut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petercunha","download_url":"https://codeload.github.com/petercunha/Donut/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248058181,"owners_count":21040712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-golf","delicious","donuts","javascript","pointless"],"created_at":"2024-11-06T19:26:32.512Z","updated_at":"2025-04-09T15:32:39.197Z","avatar_url":"https://github.com/petercunha.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Donut\nA javascript implementation of the famous \"donut.c\"\n\n\n[**Click here to see The Donut in action**](https://donut.surge.sh/)\n\n[![Donut.c](https://i.imgur.com/6jnJ8pT.png)](https://donut.surge.sh/)\n\n## The Original Code\n\nHere is the code for the original \"donut.c\" program.\n\n```C\n\n#include \u003cstdio.h\u003e\n\n             k;double sin()\n         ,cos();main(){float A=\n       0,B=0,i,j,z[1760];char b[\n     1760];printf(\"\\x1b[2J\");for(;;\n  ){memset(b,32,1760);memset(z,0,7040)\n  ;for(j=0;6.28\u003ej;j+=0.07)for(i=0;6.28\n \u003ei;i+=0.02){float c=sin(i),d=cos(j),e=\n sin(A),f=sin(j),g=cos(A),h=d+2,D=1/(c*\n h*e+f*g+5),l=cos      (i),m=cos(B),n=s\\\nin(B),t=c*h*g-f*        e;int x=40+30*D*\n(l*h*m-t*n),y=            12+15*D*(l*h*n\n+t*m),o=x+80*y,          N=8*((f*e-c*d*g\n )*m-c*d*e-f*g-l        *d*n);if(22\u003ey\u0026\u0026\n y\u003e0\u0026\u0026x\u003e0\u0026\u002680\u003ex\u0026\u0026D\u003ez[o]){z[o]=D;;;b[o]=\n \".,-~:;=!*#$@\"[N\u003e0?N:0];}}/*#****!!-*/\n  printf(\"\\x1b[H\");for(k=0;1761\u003ek;k++)\n   putchar(k%80?b[k]:10);A+=0.04;B+=\n     0.02;}}/*****####*******!!=;:~\n       ~::==!!!**********!!!==::-\n         .,~~;;;========;;;:~-.\n             ..,--------,*/\n```\n\n## How the hell...?\n\nThat's a good question. It's mostly trigonometry witchcraft and some Z-Buffering. For a deeper explanation of how it works, [read this article](https://www.a1k0n.net/2011/07/20/donut-math.html) by A1K0N.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetercunha%2Fdonut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetercunha%2Fdonut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetercunha%2Fdonut/lists"}