4 ms·
The second one is absolutely trivial if you've ever read K&R (even if you're not allowed to just call strcpy()), while the fourth one is also very straightforwa
by userbinator 5mo ago
The second one is absolutely trivial if you've ever read K&R (even if you're not allowed to just call strcpy()), while the fourth one is also very straightforward if you know about https://news.ycombinator.com/item?id=15266331 https://news.ycombinator.com/item?id=15266331 ; but 32 years ago, knowledge definitely did not propagate as quickly as it does today.
Additionally, I was allowed to store Color however I wanted — so if I needed some precomputation, I was allowed to bake it in there.
I believe it can be done in three operations, not including the precomputation.
- koolba 5mo ago> The second one is absolutely trivial if you've ever read K&R (even if you're not allowed to just call strcpy()) The naive approach’s assumes you can iterate over the first string until it terminates. It’s a bit trickier if you do not assume the memory regions cannot overlap. See memcpy vs memmove: https://man7.org/linux/man-pages/man3/memmove.3.html https://man7.org/linux/man-pages/man3/memmove.3.html
- HarHarVeryFunny 5mo agoJust tried the: y -= x >> 4; x += y >> 4; Certainly works, and seems to require 100 iterations to get a full circle. Are there other approximations, taking smaller angular steps, to get a better circle?