Versatile algorithm for computer-generated art