Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Uncategorized category for Ghosts Age by blackfaced
NEW_BORN_OP = 10000
def checkio(opacity):
magic_years = (0, 1)#years to become more transparent
IS_GHOST = lambda :opacity < NEW_BORN_OP# what is more opaque than NEW_BORN is human!
OOOOPS_I_AM_CHANGING = lambda :magic_years[0]+1# the way a ghost changes
SEE_YOU_NEXT_TIME = lambda :(magic_years[1], max(magic_years[0], 1)+magic_years[1])#next time to invisible
I_GOTCHA = lambda :magic_years[0] + opacity - NEW_BORN_OP# if you look like human, then I know your age.
while IS_GHOST():
opacity += OOOOPS_I_AM_CHANGING()
magic_years = SEE_YOU_NEXT_TIME()
return I_GOTCHA()
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio(10000) == 0, "Newborn"
assert checkio(9999) == 1, "1 year"
assert checkio(9997) == 2, "2 years"
assert checkio(9994) == 3, "3 years"
assert checkio(9995) == 4, "4 years"
assert checkio(9990) == 5, "5 years"
Oct. 27, 2013