Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 8
    \$\begingroup\$ Kudos for doing actual programming! \$\endgroup\$ Commented Feb 1, 2016 at 17:54
  • \$\begingroup\$ I really like this answer, but is there a reason you used this particular circle drawing function? The obvious version (check if ((x-xo)*(x-xo) + (y-yo)*(y-yo)) <= (r*r)) seems like it would be shorter and take out the dependency on math.h. With this size of image I don't think anything has a chance of overflowing either. \$\endgroup\$ Commented Feb 14, 2016 at 6:26
  • 2
    \$\begingroup\$ @neocpp I thought there might be a simpler way to draw a circle, but I wanted to code this without googling anything, and using the trig functions was the best I could come up with. The algorithm you suggest is great, and probably faster, but it was not obvious to me. \$\endgroup\$ Commented Feb 15, 2016 at 7:50
  • 1
    \$\begingroup\$ That's interesting, as I wouldn't have been able to come with with an algorithm like yours on my own. It somewhat reminded me of the scan line circle fill algorithm (the name escapes me right now, but it's useful to avoid checking many points), but since it worked on decreasing radii I was curious if there was some special property to this one. \$\endgroup\$ Commented Feb 15, 2016 at 7:59
  • 2
    \$\begingroup\$ I tried using a filled-circle function based on the one you suggested (see also). It runs 170x faster, and with extra code space I was able to add another circle and optimize the score down to below 6500. Fun stuff. github.com/jamieguinan/starrynight \$\endgroup\$ Commented Feb 16, 2016 at 20:36