# Seitsemäs yritys, oliot kehiin
from math import pi


class Circle:

    def __init__(self, center, radius, color):
        self.center = center
        self.radius = radius
        self.color = color
        self.area = pi * radius ** 2

    def info(self):
        print('Ympyrän keskipiste on {}, säde {} ja pinta-ala {}. Sen väri on {}'
              .format(self.center, self.radius, self.area, self.color))

    def intersects(self, other):
        (x1, y1) = self.center
        (x2, y2) = other.center
        ds = (x2 - x1) ** 2 + (y2 - y1) ** 2
        return ds <= self.radius ** 2 or ds <= other.radius ** 2

    def same_color(self, other):
        return self.color == other.color

circles = [Circle((10.0, 20.0), 2.5, (255, 0, 0)),
           Circle((0.0, -5.0), 7.5, (168, 201, 255)),
           Circle((10.5, 19.5), 3.0, (255, 0, 0)),
           Circle((5.0, -5.0), 8.5, (0, 0, 0))]

for i in range(len(circles)):
    circles[i].info()

for i1 in range(len(circles)):
    for i2 in range(i1 + 1, len(circles)):
        if circles[i1].intersects(circles[i2]):
            print('Ympyrät {} ja {} leikkaavat'.format(i1, i2))
        else:
            print('Ympyrät {} ja {} eivät leikkaa'.format(i1, i2))
        if circles[i1].same_color(circles[i2]):
            print('Ympyrät {} ja {} ovat samanväriset'.format(i1, i2))
        else:
            print('Ympyrät {} ja {} ovat eriväriset'.format(i1, i2))
