Posts

Showing posts with the label debugging

[EN] Prime numbers and speed

In an ICPC-style contest, 3-person teams compete in programming challenges, and they are allowed to bring a "notebook" into the contest. A notebook is a printable document, that teams usually fill with implementations of common algorithms, so that they are able to pull them out if needed in a contest. The other day, my ICPC team and I participated in one such contest (though an unofficial one) and we got stuck on a problem. Nevermind the details, but the solution called for finding all primes out of about a million numbers that were less than a trillion (that's 10 to the 12th power). Accordingly, our code looked something like this: // ... using ull = uint64_t; int main() { // ... vector<ull> numbers; populate(numbers); vector<ull> primes; for (ull x : numbers) if (is_prime(x)) primes.push_back(x); // ... } The only missing piece was fast primality testing. But since we already have that algorithm in o...

[EN] Broken Art

Whether it be due to numerical precision, image encoding, or logic issues, when writing or hacking on a path tracer, there tends to be a lot of duds. This is not something to be discouraged about, but a natural part of the process. (If anything, that there is any reasonable looking output at all, already means that you are 90% of the way there!) In no particular order, here are some early images that came out of a path tracer that I made. Of course, it is all the better if one gets the damned thing to work, which I did manage in the end. About me My name is Sebastian. I'm a competitive programmer (ICPC World Finalist) and coach. I also enjoy learning about programming language theory and computer graphics. Social links: Github profile LinkedIn profile Codeforces profile