My Christmas Gift to the World: A Javascript to bring about World Peace

Okay, here we go.
For you non-programmers I’m adding comments which will either start with // or /*. In the latter case they will end with */.

import Countries, WorldLeaders, Zealots, SuperVillans

//This command tells the program parser to look in these class libraries for special objects, functions and variables

var objWorldLeaders = new WorldLeaders;

//this makes it easier for me to access elements in this class

var objZealots = new Zealots;
var objSuperVillans = new SuperVillans

//Enforce World Leader Parameters conducive to peace

for each (leader in objWorldLeaders) {

// The "for each" will loop through every world leader. "leader" is now an accessible object pointing to the current leader in the stack

if (leader.insane == true) {

leader.insane = false //if the current leader is a whackjob make him sane

leader.prejudice = 0;
leader.fear = 1; //everyone's afraid of something
leader.empathy = 90;
//90% No one should be 100% empathic...that's Deanna Troi territory!

for each (zealot in objZealots) { //same looping logic as World Leaders

var beliefsystem = zealot.beliefs;

//loads the current zealots belief system into a locally declared variable for ease of handling

if (beliefsystem.nonbelievers == "evil") {

try {
//a "try/catch" wrapper will attempt some code and run everything in the catch wrapper if it errors

beliefsystem.nonbelievers = "ok";
catch(err) {

beliefsystem.beliefs = "Buddhism";
beliefsystem.strength = 100; //belief in his/her faith is now 100%

if (zealot.gender == 'M') {
zealot.desiretobeamonk = true; //the zealot now feels compelled to be a monk
} else {
if (zealot.gender == 'F') {
zealot.desiretobeanun = true; //the zealot now feels compelled to be a nun
zealot.location = "Tibet"; //what better place to be a Buddhist Monk or Nun?
zealot.passport = false; = false; = "Maxed";

// Just making sure he or she can't escape


for each (sv in objSuperVillans) { = true; //give the supervillan their own move

if (sv.gender == 'M') { = "Pauly Shore";
} else { = "Roseanne Barr";
} = "That dissheveled guy whose always at Starbucks";

//That should pretty much take care of all the supervillans :)


//This next bit is a "function". A piece of repeatable code

function EnforcePeace(objPerson) {

while (objPerson.thinking == true) {

if (objPerson.thought == "Violent" ||
objPerson.thought == "Harmful") {

objPerson.thought = "Happy";

/* This will run while a person is thinking.
If a person's thoughts become violent or harmful, their thought processes will be changed to Happy


for each (person in theWorld) {


//the "SpawnAsynchronousThread" function is one I just made up so the system won't loop on the first person until they stop thinking


Now all we need is a server to run it on! It should be a test server…its 3am, I have no idea what I’m still doing out of bed so there are probably some logic errors.

Merry Christmas everyone!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s