Created
February 18, 2016 19:50
-
-
Save dulichan/6dce0e6424d5c79a005c to your computer and use it in GitHub Desktop.
Gist of Buddha.js library https://github.com/dulichan/buddha.js
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
"use strict" | |
var UniversalTruth = require("./UniversalTruth.js").UniversalTruth; | |
class EnergyMatter extends UniversalTruth{ | |
constructor(hypothesis){ | |
super(hypothesis) | |
this.energy = 100; //finite energy | |
this.matter = 0; //finite mass | |
this.inverseFlag = true; | |
} | |
execution() { | |
if (this.inverseFlag){ | |
if (this.energy > 0){ | |
this.energy--; | |
} | |
if (this.matter < 100){ | |
this.matter++; | |
} | |
if (this.energy == 0){ | |
this.inverseFlag = false; | |
} | |
}else { | |
if (this.energy < 100){ | |
this.energy++; | |
} | |
if (this.matter > 0){ | |
this.matter--; | |
} | |
if (this.matter == 0){ | |
this.inverseFlag = true; | |
} | |
} | |
console.log("Energy = "+ this.energy + "; Matter = " + this.matter + " ::: " + this.hypothesis); | |
} | |
} | |
exports.EnergyMatter = EnergyMatter; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment