Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# extra.Make_Quake_SF_Points

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)

```        def Make_Quake_SF_Points(off):
# Quake fault lines must stay well away from the centre:
# that's enforced here.
crosses_centre = True
(x,y) = GRID_CENTRE
d = 7
check = [ (x - d, y - d), (x + d, y + d),
(x - d, y + d), (x + d, y - d) ]
(w,h) = GRID_SIZE

while ( crosses_centre ):
if ( random.randint(0,1) == 0 ):
start = (random.randint(0,w - 1), -off)
finish = (random.randint(0,w - 1), h + off)
else:
start = (-off, random.randint(0,h - 1))
finish = (h + off, random.randint(0,h - 1))

crosses_centre = (
intersect.Intersect((start, finish),
(check[ 0 ], check[ 1 ]))
or intersect.Intersect((start, finish),
(check[ 2 ], check[ 3 ])) )
return [start, finish]
```

```    def __Generate_Quake(self):
# Make start/finish points first.
line = extra.Make_Quake_SF_Points(2)

# Split line, repeatedly, at random locations.
```

```        self.storm_frame = 0