Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Javascript port of genesis(1.1 - 2.3) NEW INTERNATIONAL VERSION®
- Original project at https://www.biblegateway.com/passage/?search=Genesis+1-2&version=NIV
- Genesis was and still is a very popular framework for universe creation.
- It's first version was written in hebrew and later
- ported to greek, latin, german, english, and many other languages.
- However many of these lagnguages have become somewhat outdated.
- With genesis.js I have devoted myself to port genesis for the modern web
- and making in browser universe creation possible.
- */
- // init universe
- var days = 1;
- var heaven = new Heaven();
- var earth = new Earth();
- let light = true;
- var day = light;
- var night = !light;
- days++;
- let sky = "water vault water".split(" ")[1];
- days++;
- var land = earth.dryGround;
- var seas = earth.water;
- land.setVegetation(true);
- days++;
- var sun = new Light(day, 1.0);
- var moon = new Light(night, 0.2);
- days++;
- let fish = new Creature(seas)
- let bird = new Creature(sky)
- fish.multiply();
- bird.multiply();
- days++;
- let landAnimal = new Creature(land);
- landAnimal.multiply();
- let mankind = new Creature(land, this);
- mankind.multiply();
- mankind.isRuler = true;
- days++;
- setHoly(days);
- setTimeout(function(){
- days++;
- }, 1000*60*60*24);
- // helper functions for universe creation
- function Heaven() {
- this.toString = function () {
- return "heaven";
- };
- }
- function Earth() {
- this.water = new FluidAccumulation("water");
- this.dryGround = new DehydratedSubstrate("dry ground");
- this.toString = function () {
- return "earth";
- };
- }
- function FluidAccumulation(name) {
- this.toString = function () {
- return name;
- };
- }
- function DehydratedSubstrate(name) {
- this.vegetation = false;
- this.setVegetation = function (state) {
- this.vegetation = state;
- }
- this.toString = function () {
- return name;
- };
- }
- function Light(domain, radiance) {
- this.domain = domain;
- this.radiance = radiance;
- }
- function Creature(domain, inImageOf = false) {
- this.population = 2;
- this.domain = domain;
- this.inImageOf = inImageOf;
- this.isRuler = false;
- this.multiply = function () {
- this.population *= 2;
- };
- }
- function setHoly(thing) {
- console.log("praise " + thing + " for it is now holy");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement