The COhPy challenge for August, 2016: Refactoring!
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

The August 2016 COhPy challenge

In A.K. Dewdney's book, "The Armchair Universe", there is a chapter called "Wallpaper for the Mind". In it, he describes a number of algorithms to make pretty pictures.

A pdf of of the original Computer Recreations column on which this chapter is based can be found here.

I have implemented one of those algorithms, John E. Connett's "CIRCLE^2" in the Python program

The challenge this month is to refactor this program to:

  1. Can you make the program better at accepting input? What should it do if you input bad data?

  2. Can you document the program better?

  3. Can you make the program faster?

  4. Can you use generators to generate the plot?

  5. Can you write tests for the program?

As a bonus, are there good inputs that result in pretty pictures? Here are two:

  1. -15 -20 87
  2. -15 -20 9
  3. -4506 21539 3.12

As another bonus, can you add color? (HINT: the c%2 is a binary check (even/odd, white/black)).

As another bonus, play with different algorithms, and be able to choose them from the command line.

See for how to submit an entry.