Hasty Briefsbeta

Bilingual

I wrote a ray tracer in Brainfuck

16 hours ago
  • The author wrote a ray tracer in Brainfuck (BF) as a counterexample to a claim about writing tools in general-purpose languages.
  • BF is a simple esoteric language with 8 operations, a tape of u8 cells, and loops using brackets.
  • The implementation used a Q16.16 fixed-point format for numeric precision and a custom DSL for code generation.
  • Key challenges included implementing sqrt, random number generation, multiplication, and division using only basic BF primitives.
  • The final program was 23 MB, processed about one pixel per minute, and would take an estimated 62.5 days to render the full 400x225 image.
  • Despite the extreme slowness, only 10 out of ~90,000 generated pixels differed from the reference C implementation.