Skip to content

Instantly share code, notes, and snippets.

@qcgm1978
Forked from mattknox/inception-javascript.js
Last active March 4, 2019 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qcgm1978/3085d4c7c2902160fef99e7b7f4b5e93 to your computer and use it in GitHub Desktop.
Save qcgm1978/3085d4c7c2902160fef99e7b7f4b5e93 to your computer and use it in GitHub Desktop.
console.group("inception movie");
var inception = (function() {
/* on flight: arianna's dream */
var timerate = 1;
timerate=1/40*365*24;//The period of the final of the film reveals about forty years passed because the older man is about 80 now and was about 40 before the dream. So the period hours is 40*365*24. There are total 5 levels of all the dreams so the time rate should about 1/Math.pow(40*365*24,1/5)≈1/12.85≈0.078.
var team = ["Yusuf", "Arthur", "Eames", "Saito", "Arianna", "Dominic", "Mr.Fischer"];
console.log("Real world", team);
console.log("Time Rate is ", timerate);
console.log("1 second is %f second (what else?)", 1/timerate);
(function(timerate) {
/* Yusuf escape */
console.group("1th level: arianna's dream");
var kick = "fall in the water";
timerate /= 12;
console.log("1th level team", team);
console.log("Time Rate is ", timerate);
console.log("1 second is %f second, about %f minutes", 1/timerate, 1/timerate/60);
(function(team, timerate) {
/* Arthur hotel escape */
console.group("2nd level: Hotel escape");
var kick = "elevator wreck";
timerate /= 12;
console.log("2nd level team", team);
console.log("Time Rate is ", timerate);
console.log("1 second is %f second, about %f minutes", 1/timerate, 1/timerate/60);
(function(team, timerate) {
/* Mountain */
console.group("3rd level: Mountain's fortress");
var kick = "fortress destruction";
timerate /= 12;
console.log("3rd level team", team);
console.log("Time Rate is ", timerate);
console.log("1 second is %f second, about %f minutes", 1/timerate, 1/timerate/60);
(function(team, timerate) {
console.group("4th level: the Limbo");
/* Limbo */
var kick = "skyscrapes collapse";
timerate /= 12;
console.log("Limbo team", team);
console.log("Time Rate is ", timerate);
console.log("1 second is %f second, about %f minutes or %f hours",
1/timerate, 1/timerate/60, 1/timerate/3600);
console.groupEnd();
return kick;
})(team.slice(2), timerate); /* 4th level */
console.groupEnd();
return kick;
})(team.slice(1), timerate); /* 3nd level */
console.groupEnd();
return kick;
})(team.slice(1), timerate); /* 2nd level */
console.groupEnd();
return kick;
})(timerate); /* 1st level */
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment