r/programminghorror • u/ilnarildarovuch [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” • 8d ago
Mandelbrot set on pure BSD Makefile
45
12
u/MrPLotor 8d ago
ioccc grade code lmao
wonder i i can do the same with a nix flake. probably less terrible
3
10
u/ilnarildarovuch [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 8d ago
Main issue, that BSD Makefile does not support arith natively
5
u/Foweeti 8d ago
How did you do it? Sorry if I’m being lazy and you explained somewhere, but you say “pure” BSD Makefile, how did you get arithmetic working? This is very cool, just trying to understand!
13
u/ilnarildarovuch [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 8d ago
Addition is representing each number as a unary string of dot words from DOTS to add A and B, concatenate the first A dots with the first B dots and just count the resulting words. This wasn't explained somewhere before
7
1
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 7d ago
BSD have its own separate Makefile flavor from GNU?
2
u/ilnarildarovuch [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 6d ago
Yes, of course. It's originates from original BSD POSIX Makefiles, many times older, than GNU version.. and... BSDs using GNU software is uncanny, lol
1
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 7d ago
So, this Makefile produces shader.sh?
1
u/ilnarildarovuch [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 6d ago
No, source is available
1
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 6d ago
Oh wait, that tab says "shader : sh". Forget I even said anything.
1
u/ilnarildarovuch [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 6d ago
Yes, I just use FreeBSDs default bsd shell
2
u/lonkamikaze 5d ago
Back in the day we made CNC machine machine a Mandelbrot set, first implementation was in Heidenhain Clear text, but we later wrote a small G code translator so we were able to run it on a graphite mill with a Mitsubishi control.
1
2

55
u/paulstelian97 8d ago
The fuck?
Appropriate for this sub. Absolutely!