Created
January 24, 2021 13:04
-
-
Save navaz-alani/1ec64cb4cf27594c99a55b6310b26d8c to your computer and use it in GitHub Desktop.
Inception Dream Time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `dream_time` returns the amount of dream time elapsed in a dream at `level_depth` | |
# under a sedative factor of `sedative_factor` while sleeping for `base_time` amount | |
# of time. The units of `base_time` are seconds, and the returned dream time is also | |
# in seconds, which can be converted as desired. | |
# | |
# Tested with the dream time calculations in Inception (the movie). | |
# e.g. the sedative made by Yusuf apparently has a factor of 20. | |
def dream_time(base_time, level_depth, sedative_factor): | |
factor = 0 | |
for i in range(1, level_depth+1): | |
factor += sedative_factor**i | |
return base_time * factor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment