Merge branch 'master' of https://gitfub.space/caspervk/nightr
This commit is contained in:
commit
53e5b99ca2
|
@ -11,7 +11,7 @@ def clock(context: Context) -> Prediction:
|
|||
It's nighttime if Bing says it's daytime.
|
||||
"""
|
||||
p = Prediction()
|
||||
p.weight = 0.5
|
||||
p.weight = 0.05
|
||||
|
||||
headers = {
|
||||
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'}
|
||||
|
@ -26,8 +26,8 @@ def clock(context: Context) -> Prediction:
|
|||
time_description_oppersite = "daytime" if night else "nighttime"
|
||||
|
||||
p.reasons.append(f"Bing says its {time_description}.")
|
||||
p.reasons.append(f"We don't really trust it.")
|
||||
p.reasons.append(f"Let's guess its {time_description_oppersite}.")
|
||||
p.reasons.append(f"But we don't really trust it (who does?).")
|
||||
p.reasons.append(f"Let's guess it's {time_description_oppersite}.")
|
||||
|
||||
p.probability = 1 - p.probability
|
||||
|
||||
|
|
|
@ -27,13 +27,13 @@ def cars_in_traffic(context: Context) -> Prediction:
|
|||
diff = day_avr - night_avr
|
||||
|
||||
if curr_avg >= day_avr:
|
||||
p.reasons.append(f"Because {curr_avg} cars are driving around Aarhus right now and {day_avr} is the expected number for daytime")
|
||||
p.reasons.append(f"Because {curr_avg:.1f} cars are driving around Aarhus right now and {day_avr:.0f} is the expected number for daytime")
|
||||
p.probability = 0.0
|
||||
elif curr_avg <= night_avr:
|
||||
p.reasons.append(f"Because {curr_avg} cars are driving around Aarhus right now and {night_avr} is the expected number for nighttime")
|
||||
p.reasons.append(f"Because {curr_avg::.1f} cars are driving around Aarhus right now and {night_avr:.0f} is the expected number for nighttime")
|
||||
p.probability = 1.0
|
||||
else:
|
||||
p.reasons.append(f"Because average for daytime is {day_avr} and average for nighttime is {night_avr}, but the current average is {curr_avg}")
|
||||
p.reasons.append(f"Because average for daytime is {day_avr} and average for nighttime is {night_avr:.0f}, but the current average is {curr_avg}")
|
||||
res = 1 - curr_avg / diff
|
||||
p.probability = res
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user