|
|
@ -22,15 +22,9 @@ def main(): |
|
|
|
) |
|
|
|
|
|
|
|
# make it less likely for hills to be close to home bases |
|
|
|
home_distance_tile = np.fromfunction(distance_decay, args.size, dtype=np.float32) |
|
|
|
home_distance = np.sum([ |
|
|
|
home_distance_tile, |
|
|
|
np.flip(home_distance_tile, axis=0), |
|
|
|
np.flip(home_distance_tile, axis=1), |
|
|
|
np.flip(home_distance_tile, axis=(0,1)), |
|
|
|
], axis=0) |
|
|
|
distance_decay_tiling = np.fromfunction(distance_decay, args.size, dtype=np.float32) |
|
|
|
|
|
|
|
hills = np.where(noise - home_distance > args.threshold, "x", ".") |
|
|
|
hills = np.where(noise - distance_decay_tiling > args.threshold, "x", ".") |
|
|
|
rows = ["".join(row) for row in hills] |
|
|
|
config = { |
|
|
|
"width_per_team": args.size[0], |
|
|
@ -41,7 +35,12 @@ def main(): |
|
|
|
|
|
|
|
|
|
|
|
def distance_decay(x, y): |
|
|
|
return np.exp(-np.sqrt(x*x + y*y) / args.safezone) |
|
|
|
# calculate distance from home base |
|
|
|
dx = x - args.size[0] // 2 |
|
|
|
dy = y - args.size[1] // 2 |
|
|
|
distance = np.sqrt(dx*dx + dy*dy) |
|
|
|
# use exponential decay |
|
|
|
return np.exp(-distance / args.safezone) |
|
|
|
|
|
|
|
|
|
|
|
# Source: |
|
|
|