Why is nothing happening?


#1



Why is nothing happening?

//Power cabels can take in 500 Volts
//Backup Outputters can take output 2000 Volts
//Each client increases credit multiplication by one
//Please ignore all yellow error signs
var wel = confirm("On a stormy Tuesday night, lightning lurks the skies. Will you risk your business for a chance to make millions?");

var ezR1 = Math.floor((Math.random() * 4000) + 100);
var medR1 = Math.floor((Math.random() * 6000) + 100);
var harR1 = Math.floor((Math.random() * 12000) + 100);

var ezR2 = Math.floor((Math.random() * 4000) + 100);
var medR2 = Math.floor((Math.random() * 6000) + 100);
var harR2 = Math.floor((Math.random() * 12000) + 100);

var ezR3 = Math.floor((Math.random() * 4000) + 100);
var medR3 = Math.floor((Math.random() * 6000) + 100);
var harR3 = Math.floor((Math.random() * 12000) + 100);

var chooz = Math.random();

var amountOfPower = null;
var money = null;

var cabels = 1;
var clients = 1;
var bacout = 1;

var one = 1;

var cabelsTake = 500 * cabels;
var bacoutTake = 2000 * bacout;

var dif = prompt("Select difficulty: 1 or 2");

function Round(x){
    alert("Round " + x + " has begun!");
}

function Tell(a, b, c, d, z) {
    console.log("***********************************");
    console.log("//ROUND " + z);
    console.log("-----------------------------------");
    console.log("Credits: " + a);
    console.log("Power Cabels: " + b);
    console.log("Back Outputters: " + c);
    console.log("Clients: " + d);
    console.log("-----------------------------------");
    
}

function Strike(x) {
    console.log("⚡ KABOOM! ⚡");
    console.log("Lightning strike power: " + x + " Volts");

}
function congrats(){
    alert("Congratulations! You have made it through the storm. Your buisness continues to make millions!");
}
function blowCable(){
console.log("Oh No! One of your cables has blown up! You have " + cabels + " left!");
}

function blowBacout(){
console.log("Oh No! One of your backup outputters has blown up! You have " + cabels + " left!");
}

function LogicR1(a, b, c){
var total = ezR1 - a;
var out = total - b;
var yon = a - ezR1;

if(yon > 0) {
    var moneyEarned = ezR1 / 2 * c + 4000;
    var result = Math.round(moneyEarned); 
    money += result;
    console.log("-----------------------------------");
    console.log("Credits Earned: " + result);
    console.log("Cables/Backup Outputters Overridden: None");
    console.log("***********************************");

} else {
console.log(" ");
console.log("ALERT! ALERT! Too much power!");
console.log(" ");
console.log("Attempting to send power to Backup Outputter... ");
if(out < 0) {
var pen = 2000;
console.log("Success! Power diverted.");    
console.log("Credits Earned: " + pen);    
    console.log("***********************************");
} else {
    console.log("WARNING! Input to large!");
    if(chooz < .75 && cabels > 0){
        cabels -= 1;
        blowCable();
        console.log("Cables/Backup Outputters Overridden: 1");
    console.log("***********************************");
 
    } else if(chooz > .75 && bacout > 0) {
        bacout -= 1;
        blowBacout();
        console.log("Cables/Backup Outputters Overridden: 1");
    console.log("***********************************");
    }
}
if(bacout <= 0 || cabels <= 0){console.log("GAME OVER. Better luck next time.");}else{

}
}
//*****************************************************************
function LogicR2(a, b, c){
var total = ezR2 - a;
var out = total - b;
var yon = a - ezR2;

if(yon > 0) {
    var moneyEarned = ezR2 / 2 * c + 4000;
    var result = Math.round(moneyEarned); 
    money += result;
    console.log("-----------------------------------");
    console.log("Credits Earned: " + result);
    console.log("Cables/Backup Outputters Overridden: None");
    console.log("***********************************");

} else {
console.log(" ");
console.log("ALERT! ALERT! Too much power!");
console.log(" ");
console.log("Attempting to send power to Backup Outputter... ");
if(out < 0) {
var pen = 2000;
console.log("Success! Power diverted.");    
console.log("Credits Earned: " + pen);    
    console.log("***********************************");
} else {
    console.log("WARNING! Input to large!");
    if(chooz < .75 && cabels > 0){
        cabels -= 1;
        blowCable();
        console.log("Cables/Backup Outputters Overridden: 1");
    console.log("***********************************");
 
    } else if(chooz > .75 && bacout > 0) {
        bacout -= 1;
        blowBacout();
        console.log("Cables/Backup Outputters Overridden: 1");
    console.log("***********************************");
    }
}
if(bacout <= 0 || cabels <= 0){console.log("GAME OVER. Better luck next time.");}else{


}
}
//*****************************************************************
function LogicR3(a, b, c){
var total = ezR3 - a;
var out = total - b;
var yon = a - ezR3;

if(yon > 0) {
    var moneyEarned = ezR3 / 2 * c + 4000;
    var result = Math.round(moneyEarned); 
    money += result;
    console.log("-----------------------------------");
    console.log("Credits Earned: " + result);
    console.log("Cables/Backup Outputters Overridden: None");
    console.log("***********************************");

} else {
console.log(" ");
console.log("ALERT! ALERT! Too much power!");
console.log(" ");
console.log("Attempting to send power to Backup Outputter... ");
if(out < 0) {
var pen = 2000;
console.log("Success! Power diverted.");    
console.log("Credits Earned: " + pen);    
    console.log("***********************************");
} else {
    console.log("WARNING! Input to large!");
    if(chooz < .75 && cabels > 0){
        cabels -= 1;
        blowCable();
        console.log("Cables/Backup Outputters Overridden: 1");
    console.log("***********************************");
 
    } else if(chooz > .75 && bacout > 0) {
        bacout -= 1;
        blowBacout();
        console.log("Cables/Backup Outputters Overridden: 1");
    console.log("***********************************");
    }
}
if(bacout <= 0 || cabels <= 0){console.log("GAME OVER. Better luck next time.");}else{


}
}
if(wel === true){

if(dif === "1"){
amountOfPower = ezR1; 
money = 20000;

var shopR1 = prompt("Shop: 1.Power cable-$3000  2.Backup Outputter-$5000 3. Extra client-$30,000            Credits: " + "$" + money);

if(shopR1 === "1" && money >= 3000){
//cabels += one; works, money -= 1000; works
cabels += one;
money -= 1000;
cabelsTake = 500 * cabels;
bacoutTake = 2000 * bacout;
//Round 1
Round(1);
Tell(money, cabels, bacout, clients, "1");
Strike(ezR1);
LogicR1(cabelsTake, bacoutTake, clients);
} else if(shopR1 === "2" && money >= 5000){
money -= 5000;
cabelsTake = 500 * cabels;
bacoutTake = 2000 * bacout;
 bacout += one; 
 //Round 1
Round(1);
Tell(money, cabels, bacout, clients, "1");
Strike(ezR1);
LogicR1(cabelsTake, bacoutTake, clients);
 
} else if(shopR1 === "3" && money >= 30000){
money -= 30000;
cabelsTake = 500 * cabels;
bacoutTake = 2000 * bacout;
clients += one;
//Round 1
Round(1);
Tell(money, cabels, bacout, clients, "1");
Strike(ezR1);
LogicR1(cabelsTake, bacoutTake, clients);
} else {
    console.log("Sorry you don't have enough money to pay for that. Restart the game to retry.");
}
//////////////////////////////////////////////////////////////////////
alert("Read the text below, then press 'ok' to continue.");
amountOfPower = ezR2; 

var shopR2 = prompt("Shop: 1.Power cable-$3000  2.Backup Outputter-$5000 3. Extra client-$30,000            Credits: " + "$" + money);

if(shopR2 === "1" && money >= 3000){
//cabels += one; works, money -= 1000; works
cabels += one;
money -= 1000;
cabelsTake = 500 * cabels;
bacoutTake = 2000 * bacout;
//Round 2
Round(2);
Tell(money, cabels, bacout, clients, "2");
Strike(ezR2);
LogicR2(cabelsTake, bacoutTake, clients);
} else if(shopR2 === "2" && money >= 5000){
money -= 5000;
cabelsTake = 500 * cabels;
bacoutTake = 2000 * bacout;
 bacout += one;
 //Round 2
Round(2);
Tell(money, cabels, bacout, clients, "2");
Strike(ezR2);
LogicR2(cabelsTake, bacoutTake, clients);
 
} else if(shopR2 === "3" && money >= 30000){
money -= 30000;
cabelsTake = 500 * cabels;
bacoutTake = 2000 * bacout;
clients += one;
//Round 2
Round(2);
Tell(money, cabels, bacout, clients, "2");
Strike(ezR2);
LogicR2(cabelsTake, bacoutTake, clients);
} else {
    console.log("Sorry you don't have enough money to pay for that. Restart the game to retry.");
}

//////////////////////////////////////////////////////////////////////
alert("Read the text below, then press 'ok' to continue.");
amountOfPower = ezR3; 

var shopR3 = prompt("Shop: 1.Power cable-$3000  2.Backup Outputter-$5000 3. Extra client-$30,000            Credits: " + "$" + money);

if(shopR3 === "1" && money >= 3000){
//cabels += one; works, money -= 1000; works
cabels += one;
money -= 1000;
cabelsTake = 500 * cabels;
bacoutTake = 2000 * bacout;
//Round 3
Round(3);
Tell(money, cabels, bacout, clients, "3");
Strike(ezR3);
LogicR3(cabelsTake, bacoutTake, clients);
} else if(shopR3 === "2" && money >= 5000){
money -= 5000;
cabelsTake = 500 * cabels;
bacoutTake = 2000 * bacout;
 bacout += one; 
 //Round 3
Round(3);
Tell(money, cabels, bacout, clients, "3");
Strike(ezR3);
LogicR3(cabelsTake, bacoutTake, clients);
 
} else if(shopR3 === "3" && money >= 30000){
money -= 30000;
cabelsTake = 500 * cabels;
bacoutTake = 2000 * bacout;
clients += one;
//Round 3
Round(3);
Tell(money, cabels, bacout, clients, "3");
Strike(ezR3);
LogicR3(cabelsTake, bacoutTake, clients);
} else {
    console.log("Sorry you don't have enough money to pay for that. Restart the game to retry.");
}






} else if(dif === "2"){
amountOfPower = med;
money = 10000;

} else {
    console.log("Sorry but that is not a valid difficulty level.");
}
} 
}}}


Replace this line with your code.


#2

Is this for an exercise on Codecademy, it doesn't look like rock, paper scissors to me?
What are you expecting to happen?


#3

I am looking for help. What else would I be doing?


#4

First answer this question: is this a codecademy exercise?

I'll refrase my second question: what do you expect the code to be doing? what do you want it to do?


#5

No.
To be responding to the player's actions through the game.
Let me give you a more formatted version of the code.

//Power cabels can take in 500 Volts
//Backup Outputters can output 2000 Volts
//Each client increases credit multiplication by one
//Please ignore all yellow error signs
var wel = confirm("On a stormy Tuesday night, lightning lurks the skies. Will you risk your business for a chance to make millions?");

var ezR1 = Math.floor((Math.random() * 4000) + 100);
var medR1 = Math.floor((Math.random() * 6000) + 100);
var harR1 = Math.floor((Math.random() * 12000) + 100);

var ezR2 = Math.floor((Math.random() * 4000) + 100);
var medR2 = Math.floor((Math.random() * 6000) + 100);
var harR2 = Math.floor((Math.random() * 12000) + 100);

var ezR3 = Math.floor((Math.random() * 4000) + 100);
var medR3 = Math.floor((Math.random() * 6000) + 100);
var harR3 = Math.floor((Math.random() * 12000) + 100);

var chooz = Math.random();

var amountOfPower = null;
var money = null;

var cabels = 1;
var clients = 1;
var bacout = 1;

var one = 1;

var cabelsTake = 500 * cabels;
var bacoutTake = 2000 * bacout;

var dif = prompt("Select difficulty: 1 or 2");

function Round(x) {
    alert("Round " + x + " has begun!");
}

function Tell(a, b, c, d, z) {
    console.log("***********************************");
    console.log("//ROUND " + z);
    console.log("-----------------------------------");
    console.log("Credits: " + a);
    console.log("Power Cabels: " + b);
    console.log("Back Outputters: " + c);
    console.log("Clients: " + d);
    console.log("-----------------------------------");

}

function Strike(x) {
    console.log("⚡ KABOOM! ⚡");
    console.log("Lightning strike power: " + x + " Volts");

}

function congrats() {
    alert("Congratulations! You have made it through the storm. Your buisness continues to make millions!");
}

function blowCable() {
    console.log("Oh No! One of your cables has blown up! You have " + cabels + " left!");
}

function blowBacout() {
    console.log("Oh No! One of your backup outputters has blown up! You have " + cabels + " left!");
}

function LogicR1(a, b, c) {
    var total = ezR1 - a;
    var out = total - b;
    var yon = a - ezR1;

    if (yon > 0) {
        var moneyEarned = ezR1 / 2 * c + 4000;
        var result = Math.round(moneyEarned);
        money += result;
        console.log("-----------------------------------");
        console.log("Credits Earned: " + result);
        console.log("Cables/Backup Outputters Overridden: None");
        console.log("***********************************");

    } else {
        console.log(" ");
        console.log("ALERT! ALERT! Too much power!");
        console.log(" ");
        console.log("Attempting to send power to Backup Outputter... ");
        if (out < 0) {
            var pen = 2000;
            console.log("Success! Power diverted.");
            console.log("Credits Earned: " + pen);
            console.log("***********************************");
        } else {
            console.log("WARNING! Input to large!");
            if (chooz < .75 && cabels > 0) {
                cabels -= 1;
                blowCable();
                console.log("Cables/Backup Outputters Overridden: 1");
                console.log("***********************************");

            } else if (chooz > .75 && bacout > 0) {
                bacout -= 1;
                blowBacout();
                console.log("Cables/Backup Outputters Overridden: 1");
                console.log("***********************************");
            }
        }
        if (bacout <= 0 || cabels <= 0) {
            console.log("GAME OVER. Better luck next time.");
        } else {

        }
    }
    //*****************************************************************
    function LogicR2(a, b, c) {
        var total = ezR2 - a;
        var out = total - b;
        var yon = a - ezR2;

        if (yon > 0) {
            var moneyEarned = ezR2 / 2 * c + 4000;
            var result = Math.round(moneyEarned);
            money += result;
            console.log("-----------------------------------");
            console.log("Credits Earned: " + result);
            console.log("Cables/Backup Outputters Overridden: None");
            console.log("***********************************");

        } else {
            console.log(" ");
            console.log("ALERT! ALERT! Too much power!");
            console.log(" ");
            console.log("Attempting to send power to Backup Outputter... ");
            if (out < 0) {
                var pen = 2000;
                console.log("Success! Power diverted.");
                console.log("Credits Earned: " + pen);
                console.log("***********************************");
            } else {
                console.log("WARNING! Input to large!");
                if (chooz < .75 && cabels > 0) {
                    cabels -= 1;
                    blowCable();
                    console.log("Cables/Backup Outputters Overridden: 1");
                    console.log("***********************************");

                } else if (chooz > .75 && bacout > 0) {
                    bacout -= 1;
                    blowBacout();
                    console.log("Cables/Backup Outputters Overridden: 1");
                    console.log("***********************************");
                }
            }
            if (bacout <= 0 || cabels <= 0) {
                console.log("GAME OVER. Better luck next time.");
            } else {


            }
        }
        //*****************************************************************
        function LogicR3(a, b, c) {
            var total = ezR3 - a;
            var out = total - b;
            var yon = a - ezR3;

            if (yon > 0) {
                var moneyEarned = ezR3 / 2 * c + 4000;
                var result = Math.round(moneyEarned);
                money += result;
                console.log("-----------------------------------");
                console.log("Credits Earned: " + result);
                console.log("Cables/Backup Outputters Overridden: None");
                console.log("***********************************");

            } else {
                console.log(" ");
                console.log("ALERT! ALERT! Too much power!");
                console.log(" ");
                console.log("Attempting to send power to Backup Outputter... ");
                if (out < 0) {
                    var pen = 2000;
                    console.log("Success! Power diverted.");
                    console.log("Credits Earned: " + pen);
                    console.log("***********************************");
                } else {
                    console.log("WARNING! Input to large!");
                    if (chooz < .75 && cabels > 0) {
                        cabels -= 1;
                        blowCable();
                        console.log("Cables/Backup Outputters Overridden: 1");
                        console.log("***********************************");

                    } else if (chooz > .75 && bacout > 0) {
                        bacout -= 1;
                        blowBacout();
                        console.log("Cables/Backup Outputters Overridden: 1");
                        console.log("***********************************");
                    }
                }
                if (bacout <= 0 || cabels <= 0) {
                    console.log("GAME OVER. Better luck next time.");
                } else {


                }
            }
            if (wel === true) {

                if (dif === "1") {
                    amountOfPower = ezR1;
                    money = 20000;

                    var shopR1 = prompt("Shop: 1.Power cable-$3000  2.Backup Outputter-$5000 3. Extra client-$30,000            Credits: " + "$" + money);

                    if (shopR1 === "1" && money >= 3000) {
                        //cabels += one; works, money -= 1000; works
                        cabels += one;
                        money -= 1000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        //Round 1
                        Round(1);
                        Tell(money, cabels, bacout, clients, "1");
                        Strike(ezR1);
                        LogicR1(cabelsTake, bacoutTake, clients);
                    } else if (shopR1 === "2" && money >= 5000) {
                        money -= 5000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        bacout += one;
                        //Round 1
                        Round(1);
                        Tell(money, cabels, bacout, clients, "1");
                        Strike(ezR1);
                        LogicR1(cabelsTake, bacoutTake, clients);

                    } else if (shopR1 === "3" && money >= 30000) {
                        money -= 30000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        clients += one;
                        //Round 1
                        Round(1);
                        Tell(money, cabels, bacout, clients, "1");
                        Strike(ezR1);
                        LogicR1(cabelsTake, bacoutTake, clients);
                    } else {
                        console.log("Sorry you don't have enough money to pay for that. Restart the game to retry.");
                    }
                    //////////////////////////////////////////////////////////////////////
                    alert("Read the text below, then press 'ok' to continue.");
                    amountOfPower = ezR2;

                    var shopR2 = prompt("Shop: 1.Power cable-$3000  2.Backup Outputter-$5000 3. Extra client-$30,000            Credits: " + "$" + money);

                    if (shopR2 === "1" && money >= 3000) {
                        //cabels += one; works, money -= 1000; works
                        cabels += one;
                        money -= 1000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        //Round 2
                        Round(2);
                        Tell(money, cabels, bacout, clients, "2");
                        Strike(ezR2);
                        LogicR2(cabelsTake, bacoutTake, clients);
                    } else if (shopR2 === "2" && money >= 5000) {
                        money -= 5000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        bacout += one;
                        //Round 2
                        Round(2);
                        Tell(money, cabels, bacout, clients, "2");
                        Strike(ezR2);
                        LogicR2(cabelsTake, bacoutTake, clients);

                    } else if (shopR2 === "3" && money >= 30000) {
                        money -= 30000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        clients += one;
                        //Round 2
                        Round(2);
                        Tell(money, cabels, bacout, clients, "2");
                        Strike(ezR2);
                        LogicR2(cabelsTake, bacoutTake, clients);
                    } else {
                        console.log("Sorry you don't have enough money to pay for that. Restart the game to retry.");
                    }

                    //////////////////////////////////////////////////////////////////////
                    alert("Read the text below, then press 'ok' to continue.");
                    amountOfPower = ezR3;

                    var shopR3 = prompt("Shop: 1.Power cable-$3000  2.Backup Outputter-$5000 3. Extra client-$30,000            Credits: " + "$" + money);

                    if (shopR3 === "1" && money >= 3000) {
                        //cabels += one; works, money -= 1000; works
                        cabels += one;
                        money -= 1000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        //Round 3
                        Round(3);
                        Tell(money, cabels, bacout, clients, "3");
                        Strike(ezR3);
                        LogicR3(cabelsTake, bacoutTake, clients);
                    } else if (shopR3 === "2" && money >= 5000) {
                        money -= 5000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        bacout += one;
                        //Round 3
                        Round(3);
                        Tell(money, cabels, bacout, clients, "3");
                        Strike(ezR3);
                        LogicR3(cabelsTake, bacoutTake, clients);

                    } else if (shopR3 === "3" && money >= 30000) {
                        money -= 30000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        clients += one;
                        //Round 3
                        Round(3);
                        Tell(money, cabels, bacout, clients, "3");
                        Strike(ezR3);
                        LogicR3(cabelsTake, bacoutTake, clients);
                    } else {
                        console.log("Sorry you don't have enough money to pay for that. Restart the game to retry.");
                    }




                } else if (dif === "2") {
                    amountOfPower = med;
                    money = 10000;

                } else {
                    console.log("Sorry but that is not a valid difficulty level.");
                }
            }
        }
    }
}

#6

Correct me if I'm wrong, but I see a lot of functions, but no function calls. How does the program know which functions to run?


#7

Some of them I won't call until the end, but under the //Round signs, is where the functions are mainly called. I am having trouble with the prompts popping up. Not the functions.


#8

Yeah, but those //Round signs are also in functions, which have to be called
A function doesn't start automatically


#9

No. I am talking about the commented out Round, not the function.


#10

I know, they're inside a function called LogicR3


#11

I don't see it. Can you please show me where it is.


#12

Try to find this comment. If you go up, you can see that it's inside a function called LogicR3


#13

There is still nothing happening.

//Power cabels can take in 500 Volts
//Backup Outputters can output 2000 Volts
//Each client increases credit multiplication by one
//Please ignore all yellow error signs
var wel = confirm("On a stormy Tuesday night, lightning lurks the skies. Will you risk your business for a chance to make millions?");

var ezR1 = Math.floor((Math.random() * 4000) + 100);
var medR1 = Math.floor((Math.random() * 6000) + 100);
var harR1 = Math.floor((Math.random() * 12000) + 100);

var ezR2 = Math.floor((Math.random() * 4000) + 100);
var medR2 = Math.floor((Math.random() * 6000) + 100);
var harR2 = Math.floor((Math.random() * 12000) + 100);

var ezR3 = Math.floor((Math.random() * 4000) + 100);
var medR3 = Math.floor((Math.random() * 6000) + 100);
var harR3 = Math.floor((Math.random() * 12000) + 100);

var chooz = Math.random();

var amountOfPower = null;
var money = null;

var cabels = 1;
var clients = 1;
var bacout = 1;

var one = 1;

var cabelsTake = 500 * cabels;
var bacoutTake = 2000 * bacout;

var dif = prompt("Select difficulty: 1 or 2");

function Round(x) {
    alert("Round " + x + " has begun!");
}

function Tell(a, b, c, d, z) {
    console.log("***********************************");
    console.log("//ROUND " + z);
    console.log("-----------------------------------");
    console.log("Credits: " + a);
    console.log("Power Cabels: " + b);
    console.log("Back Outputters: " + c);
    console.log("Clients: " + d);
    console.log("-----------------------------------");

}

function Strike(x) {
    console.log("⚡ KABOOM! ⚡");
    console.log("Lightning strike power: " + x + " Volts");

}

function congrats() {
    alert("Congratulations! You have made it through the storm. Your buisness continues to make millions!");
}

function blowCable() {
    console.log("Oh No! One of your cables has blown up! You have " + cabels + " left!");
}

function blowBacout() {
    console.log("Oh No! One of your backup outputters has blown up! You have " + cabels + " left!");
}

function LogicR1(a, b, c) {
    var total = ezR1 - a;
    var out = total - b;
    var yon = a - ezR1;

    if (yon > 0) {
        var moneyEarned = ezR1 / 2 * c + 4000;
        var result = Math.round(moneyEarned);
        money += result;
        console.log("-----------------------------------");
        console.log("Credits Earned: " + result);
        console.log("Cables/Backup Outputters Overridden: None");
        console.log("***********************************");

    } else {
        console.log(" ");
        console.log("ALERT! ALERT! Too much power!");
        console.log(" ");
        console.log("Attempting to send power to Backup Outputter... ");
        if (out < 0) {
            var pen = 2000;
            console.log("Success! Power diverted.");
            console.log("Credits Earned: " + pen);
            console.log("***********************************");
        } else {
            console.log("WARNING! Input to large!");
            if (chooz < .75 && cabels > 0) {
                cabels -= 1;
                blowCable();
                console.log("Cables/Backup Outputters Overridden: 1");
                console.log("***********************************");

            } else if (chooz > .75 && bacout > 0) {
                bacout -= 1;
                blowBacout();
                console.log("Cables/Backup Outputters Overridden: 1");
                console.log("***********************************");
            }
        }
        if (bacout <= 0 || cabels <= 0) {
            console.log("GAME OVER. Better luck next time.");
        } else {

        }
    }
    //*****************************************************************
    function LogicR2(a, b, c) {
        var total = ezR2 - a;
        var out = total - b;
        var yon = a - ezR2;

        if (yon > 0) {
            var moneyEarned = ezR2 / 2 * c + 4000;
            var result = Math.round(moneyEarned);
            money += result;
            console.log("-----------------------------------");
            console.log("Credits Earned: " + result);
            console.log("Cables/Backup Outputters Overridden: None");
            console.log("***********************************");

        } else {
            console.log(" ");
            console.log("ALERT! ALERT! Too much power!");
            console.log(" ");
            console.log("Attempting to send power to Backup Outputter... ");
            if (out < 0) {
                var pen = 2000;
                console.log("Success! Power diverted.");
                console.log("Credits Earned: " + pen);
                console.log("***********************************");
            } else {
                console.log("WARNING! Input to large!");
                if (chooz < .75 && cabels > 0) {
                    cabels -= 1;
                    blowCable();
                    console.log("Cables/Backup Outputters Overridden: 1");
                    console.log("***********************************");

                } else if (chooz > .75 && bacout > 0) {
                    bacout -= 1;
                    blowBacout();
                    console.log("Cables/Backup Outputters Overridden: 1");
                    console.log("***********************************");
                }
            }
            if (bacout <= 0 || cabels <= 0) {
                console.log("GAME OVER. Better luck next time.");
            } else {


            }
        }
        //*****************************************************************
        function LogicR3(a, b, c) {
            var total = ezR3 - a;
            var out = total - b;
            var yon = a - ezR3;

            if (yon > 0) {
                var moneyEarned = ezR3 / 2 * c + 4000;
                var result = Math.round(moneyEarned);
                money += result;
                console.log("-----------------------------------");
                console.log("Credits Earned: " + result);
                console.log("Cables/Backup Outputters Overridden: None");
                console.log("***********************************");

            } else {
                console.log(" ");
                console.log("ALERT! ALERT! Too much power!");
                console.log(" ");
                console.log("Attempting to send power to Backup Outputter... ");
                if (out < 0) {
                    var pen = 2000;
                    console.log("Success! Power diverted.");
                    console.log("Credits Earned: " + pen);
                    console.log("***********************************");
                } else {
                    console.log("WARNING! Input to large!");
                    if (chooz < .75 && cabels > 0) {
                        cabels -= 1;
                        blowCable();
                        console.log("Cables/Backup Outputters Overridden: 1");
                        console.log("***********************************");

                    } else if (chooz > .75 && bacout > 0) {
                        bacout -= 1;
                        blowBacout();
                        console.log("Cables/Backup Outputters Overridden: 1");
                        console.log("***********************************");
                    }
                }
                if (bacout <= 0 || cabels <= 0) {
                    console.log("GAME OVER. Better luck next time.");
                } else {


                }}
            }
            if (wel === true) {

                if (dif === "1") {
                    amountOfPower = ezR1;
                    money = 20000;

                    var shopR1 = prompt("Shop: 1.Power cable-$3000  2.Backup Outputter-$5000 3. Extra client-$30,000            Credits: " + "$" + money);

                    if (shopR1 === "1" && money >= 3000) {
                        //cabels += one; works, money -= 1000; works
                        cabels += one;
                        money -= 1000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        //Round 1
                        Round(1);
                        Tell(money, cabels, bacout, clients, "1");
                        Strike(ezR1);
                        LogicR1(cabelsTake, bacoutTake, clients);
                    } else if (shopR1 === "2" && money >= 5000) {
                        money -= 5000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        bacout += one;
                        //Round 1
                        Round(1);
                        Tell(money, cabels, bacout, clients, "1");
                        Strike(ezR1);
                        LogicR1(cabelsTake, bacoutTake, clients);

                    } else if (shopR1 === "3" && money >= 30000) {
                        money -= 30000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        clients += one;
                        //Round 1
                        Round(1);
                        Tell(money, cabels, bacout, clients, "1");
                        Strike(ezR1);
                        LogicR1(cabelsTake, bacoutTake, clients);
                    } else {
                        console.log("Sorry you don't have enough money to pay for that. Restart the game to retry.");
                    }
                    //////////////////////////////////////////////////////////////////////
                    alert("Read the text below, then press 'ok' to continue.");
                    amountOfPower = ezR2;

                    var shopR2 = prompt("Shop: 1.Power cable-$3000  2.Backup Outputter-$5000 3. Extra client-$30,000            Credits: " + "$" + money);

                    if (shopR2 === "1" && money >= 3000) {
                        //cabels += one; works, money -= 1000; works
                        cabels += one;
                        money -= 1000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        //Round 2
                        Round(2);
                        Tell(money, cabels, bacout, clients, "2");
                        Strike(ezR2);
                        LogicR2(cabelsTake, bacoutTake, clients);
                    } else if (shopR2 === "2" && money >= 5000) {
                        money -= 5000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        bacout += one;
                        //Round 2
                        Round(2);
                        Tell(money, cabels, bacout, clients, "2");
                        Strike(ezR2);
                        LogicR2(cabelsTake, bacoutTake, clients);

                    } else if (shopR2 === "3" && money >= 30000) {
                        money -= 30000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        clients += one;
                        //Round 2
                        Round(2);
                        Tell(money, cabels, bacout, clients, "2");
                        Strike(ezR2);
                        LogicR2(cabelsTake, bacoutTake, clients);
                    } else {
                        console.log("Sorry you don't have enough money to pay for that. Restart the game to retry.");
                    }

                    //////////////////////////////////////////////////////////////////////
                    alert("Read the text below, then press 'ok' to continue.");
                    amountOfPower = ezR3;

                    var shopR3 = prompt("Shop: 1.Power cable-$3000  2.Backup Outputter-$5000 3. Extra client-$30,000            Credits: " + "$" + money);

                    if (shopR3 === "1" && money >= 3000) {
                        //cabels += one; works, money -= 1000; works
                        cabels += one;
                        money -= 1000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        //Round 3
                        Round(3);
                        Tell(money, cabels, bacout, clients, "3");
                        Strike(ezR3);
                        LogicR3(cabelsTake, bacoutTake, clients);
                    } else if (shopR3 === "2" && money >= 5000) {
                        money -= 5000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        bacout += one;
                        //Round 3
                        Round(3);
                        Tell(money, cabels, bacout, clients, "3");
                        Strike(ezR3);
                        LogicR3(cabelsTake, bacoutTake, clients);

                    } else if (shopR3 === "3" && money >= 30000) {
                        money -= 30000;
                        cabelsTake = 500 * cabels;
                        bacoutTake = 2000 * bacout;
                        clients += one;
                        //Round 3
                        Round(3);
                        Tell(money, cabels, bacout, clients, "3");
                        Strike(ezR3);
                        LogicR3(cabelsTake, bacoutTake, clients);
                    } else {
                        console.log("Sorry you don't have enough money to pay for that. Restart the game to retry.");
           }




                } else if (dif === "2") {
                    amountOfPower = med;
                    money = 10000;

                } else {
                    console.log("Sorry but that is not a valid difficulty level.");
                }
            }
        }
    
}

#14

Let's try to make a map of what functions you have:

LogicR1 # This takes three numbers a,b and c (what are these)
-- LogicR2 # This is defined inside LogicR1 and is only accesible from within this.
---- LogicR3 # This is defined inside LogicR2

I think this is definitely not what you intended, but it happened because of misplaced curly braces.

What function do you want to call first and with what arguments?


#15

Thank you. I have fixed my program!