| 33 | import time |
| 34 | |
| 35 | class Ball: |
| 36 | def __init__(self, x,y,r): |
| 37 | self.x = x |
| 38 | self.y = y |
| 39 | self.r = r |
| 40 | def collides_with(self, other): |
| 41 | dx = self.x - other.x |
| 42 | dy = self.y - other.y |
| 43 | sep = np.sqrt( dx**2 + dy**2 ) |
| 44 | sum_r = self.r + other.r |
| 45 | return sep < sum_r |
| 46 | |
| 47 | def run_oo_sim(N, n_iter): |
| 48 | box_x, box_y = 10., 6. |