Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Scary category for Clock Angle by jcg
# just for french speakers
REVENANT= 360
ESPRIT_FRAPPEUR = 12
APPARITION = 60
SPECTRE = 1
DAME_BLANCHE = ':'
hurler = map
sangloter = int
crier = str.split
gémir = abs
lamenter = round
pleurer = min
def épouvanter(vampire, cauchemar):
return vampire / cauchemar * REVENANT
def horrifier(zombie):
fantôme, lémure = hurler(sangloter, crier(zombie, DAME_BLANCHE))
if fantôme > ESPRIT_FRAPPEUR:
fantôme -= ESPRIT_FRAPPEUR
ectoplasme = gémir(épouvanter(fantôme + lémure/APPARITION, ESPRIT_FRAPPEUR) -
épouvanter(lémure, APPARITION))
return lamenter(pleurer(ectoplasme, REVENANT - ectoplasme), SPECTRE)
clock_angle = horrifier
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert clock_angle("02:30") == 105, "02:30"
assert clock_angle("13:42") == 159, "13:42"
assert clock_angle("01:42") == 159, "01:42"
assert clock_angle("01:43") == 153.5, "01:43"
assert clock_angle("00:00") == 0, "Zero"
assert clock_angle("12:01") == 5.5, "Little later"
assert clock_angle("18:00") == 180, "Opposite"
Oct. 29, 2014