Hacker News new | comments | show | ask | jobs | submit login

I actually went through that exercise if anyone is interested.

It ended up at probably 500 lines at first, and then 800 or so lines because I tried to port it to CUDA. It was mainly an exercise in learning CUDA -- i.e. how is CUDA different than C++? I got something running on my graphics card, but it didn't completely work and I moved onto other things.

I haven't run this code since 2015 but I did have a lot of fun learning from it.

    $ wc -l smallpt.cpp 
    811 smallpt.cpp
Another nice codebase I learned from is tinypy:

http://www.tinypy.org/

It's written in a similarly condensed style. I'm inclined to agree with you at first, but honestly I find that reformatting code helps me get a feel for it! It is a mechanical exercise that reminds you of everything that's there. Going through and renaming functions and types to "your style" seems kinda frivolous but it actually helps IMO.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: