Skip to content

Instantly share code, notes, and snippets.

@dulichan
Created February 18, 2016 19:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dulichan/6dce0e6424d5c79a005c to your computer and use it in GitHub Desktop.
Save dulichan/6dce0e6424d5c79a005c to your computer and use it in GitHub Desktop.
Gist of Buddha.js library https://github.com/dulichan/buddha.js
"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