Advertisement
Guest User

Untitled

a guest
Jul 17th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3. Javascript port of genesis(1.1 - 2.3) NEW INTERNATIONAL VERSION®
  4. Original project at https://www.biblegateway.com/passage/?search=Genesis+1-2&version=NIV
  5.  
  6. Genesis was and still is a very popular framework for universe creation.
  7. It's first version was written in hebrew and later
  8. ported to greek, latin, german, english, and many other languages.
  9. However many of these lagnguages have become somewhat outdated.
  10. With genesis.js I have devoted myself to port genesis for the modern web
  11. and making in browser universe creation possible.
  12.  
  13. */
  14.  
  15.  
  16. // init universe
  17.  
  18. var days = 1;
  19.  
  20. var heaven = new Heaven();
  21. var earth = new Earth();
  22.  
  23. let light = true;
  24.  
  25. var day = light;
  26. var night = !light;
  27.  
  28. days++;
  29.  
  30. let sky = "water vault water".split(" ")[1];
  31.  
  32. days++;
  33.  
  34.  var land = earth.dryGround;
  35.  var seas = earth.water;
  36.  
  37. land.setVegetation(true);
  38.  
  39. days++;
  40.  
  41. var sun = new Light(day, 1.0);
  42. var moon = new Light(night, 0.2);
  43.  
  44. days++;
  45.  
  46. let fish = new Creature(seas)
  47. let bird = new Creature(sky)
  48. fish.multiply();
  49. bird.multiply();
  50.  
  51. days++;
  52.  
  53. let landAnimal = new Creature(land);
  54. landAnimal.multiply();
  55.  
  56. let mankind = new Creature(land, this);
  57. mankind.multiply();
  58. mankind.isRuler = true;
  59.  
  60. days++;
  61.  
  62. setHoly(days);
  63. setTimeout(function(){
  64.    days++;
  65. }, 1000*60*60*24);
  66.  
  67.  
  68.  
  69.  
  70. // helper functions for universe creation
  71.  
  72. function Heaven() {
  73.     this.toString = function () {
  74.         return "heaven";
  75.     };
  76. }
  77.  
  78. function Earth() {
  79.     this.water = new FluidAccumulation("water");
  80.     this.dryGround = new DehydratedSubstrate("dry ground");
  81.     this.toString = function () {
  82.         return "earth";
  83.     };
  84. }
  85.  
  86. function FluidAccumulation(name) {
  87.     this.toString = function () {
  88.         return name;
  89.     };
  90. }
  91.  
  92. function DehydratedSubstrate(name) {
  93.     this.vegetation = false;
  94.     this.setVegetation = function (state) {
  95.         this.vegetation = state;
  96.     }
  97.     this.toString = function () {
  98.         return name;
  99.     };
  100. }
  101.  
  102. function Light(domain, radiance) {
  103.     this.domain = domain;
  104.     this.radiance = radiance;
  105. }
  106.  
  107. function Creature(domain, inImageOf = false) {
  108.     this.population = 2;
  109.     this.domain = domain;
  110.     this.inImageOf = inImageOf;
  111.     this.isRuler = false;
  112.     this.multiply = function () {
  113.         this.population *= 2;
  114.     };
  115. }
  116.  
  117. function setHoly(thing) {
  118.     console.log("praise " + thing + " for it is now holy");
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement