Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Method Monte Carlo solution in Creative category for Four To The Floor by fishsouprecipe
import random
import math
def is_covered(room, sensors):
"""
Monte Carlo Method exapmle :\
https://en.wikipedia.org/wiki/Monte_Carlo_method
Just like it
"""
for _ in range(5000000):
random_x, random_y = (random.random() * c for c in room)
if not any(sensor_r >= math.sqrt(math.pow(random_x - sensor_x, 2) +
math.pow(random_y - sensor_y, 2))
for sensor_x, sensor_y, sensor_r in sensors):
return False
return True
March 15, 2020
Comments: