Add Painter.rb but it has wrong algorithm. Necessary to fix.