BullyWiiHacks
Welcome dear guest! Very Happy

To start posting and being part of the BWH community, you simply need to register an account or log into an existing one.

If you do not wish to register at all, that's fine but there will be more advertisements. :/

You can probably see and download most content provided for regular members even without an account.

Your contributions will be greatly appreciated though, give it a shot and register today! thumbsup

Join the forum, it's quick and easy

BullyWiiHacks
Welcome dear guest! Very Happy

To start posting and being part of the BWH community, you simply need to register an account or log into an existing one.

If you do not wish to register at all, that's fine but there will be more advertisements. :/

You can probably see and download most content provided for regular members even without an account.

Your contributions will be greatly appreciated though, give it a shot and register today! thumbsup
BullyWiiHacks
Would you like to react to this message? Create an account in a few clicks or log in to continue.
BullyWiiHacks

Gaming, Modding & Programming

Important reminders:

- Click *HERE* for advanced forum search or check out the text field below on the front page for Google before posting
- NO support via private message (use the forum)
- Write meaningful topic titles
Site Translation
Latest topics
» Dropped Out of College to Pursue Web Dev and Life Pursuits in General
 Nuke, Foot, Cockroach Empty4/7/2024, 2:34 pm by SnB@BWH

» Bully Made It Into a BIG Video 400K Views
 Nuke, Foot, Cockroach Empty4/7/2024, 6:58 am by Bully@WiiPlaza

» Wii Play Tanks
 Nuke, Foot, Cockroach Empty3/24/2024, 2:46 pm by helpmeout

» [Bypass Paywalls] (Global) @magnolia1234 - GitLab
 Nuke, Foot, Cockroach Empty3/18/2024, 3:55 am by Seth@WiiPlaza

» [Download] Mary Shelley's Frankenhole
 Nuke, Foot, Cockroach Empty3/16/2024, 8:29 am by Seth@WiiPlaza

» Completely Custom Modded Controllers (Undetectable)
 Nuke, Foot, Cockroach Empty3/5/2024, 1:55 pm by Shadow@BWH

» (Zombies) Drink perks code?
 Nuke, Foot, Cockroach Empty3/5/2024, 1:24 pm by Shadow@BWH

» Die Rückkehr zu STEAM und WARFACE
 Nuke, Foot, Cockroach Empty3/2/2024, 3:54 am by Seth@WiiPlaza

» First person hand model change?
 Nuke, Foot, Cockroach Empty2/28/2024, 4:53 am by Ad3lamac611

» {RELEASE} Field Raider Firefox v1.72 by Seth@WiiPlaza
 Nuke, Foot, Cockroach Empty2/21/2024, 8:52 am by naxil

Search
 
 

Display results as :
 


Rechercher Advanced Search

April 2024
MonTueWedThuFriSatSun
1234567
891011121314
15161718192021
22232425262728
2930     

Calendar Calendar

Country Statistics
Free counters!

You are not connected. Please login or register

Nuke, Foot, Cockroach

2 posters

Go down  Message [Page 1 of 1]

1 Nuke, Foot, Cockroach Empty Nuke, Foot, Cockroach 12/8/2014, 4:38 am

Shadow@BWH

Shadow@BWH
 
 

Rock, paper, scissors with my own creative twist. Cool

Code:
console.log("    Nuke, Foot, Cockroach!");
console.log("      Made By Shadow@BWH");

/*Variables and game setup*/
var played = 0;
var score1 = 0;
var score2 = 0;
var times = Number(prompt("How often do you want to play?"));
if (isNaN(times)) {
    times = 1;
    console.log("\nInvalid input!\nNumber of rounds set to 1!");
}
else console.log("\nYou chose to play "+ times +" times.");

/*FUNCTION COMPARING CHOICES*/
var compare=function(choice1,choice2) {   
    if (choice1===choice2) {
        console.log("Its a tie. Choose again!");
    }
    else if (choice1==="nuke") {
      if (choice2==="foot") {
        console.log("Nuke blows up foot."); 
        console.log("Player 1 wins this round.");
        score1+=1;
      }   
      else if (choice2==="cockroach") {
        console.log("cockroach survives nuke."); 
        console.log("The computer wins this round.");
        score2+=1;
      }
    }
    else if (choice1==="foot") {
      if (choice2==="cockroach") {
        console.log("Foot crushes cockroach."); 
        console.log("Player 1 wins this round.");
        score1+=1;
      }
      else if (choice2==="nuke") {
        console.log("Nuke blows up foot.");
        console.log("The computer wins this round.");
        score2+=1;
      }
    }
    else if (choice1==="cockroach") {
      if (choice2==="foot") {
        console.log("Foot crushes cockroach."); 
        console.log("The computer wins this round.");
        score2+=1;
      }
      else if (choice2==="nuke") {
        console.log("Cockroach survives nuke.");
        console.log("Player 1 wins this round.");
        score1+=1;
      }
    }
};
/*END OF FUNCTION*/

do { // repeats game x times, as specified by player
    played += 1;
    console.log("\nRound "+ played+"/"+times);
    do { // repeats code as long as game is tied
        do { // repeats code until player enters proper input
            if (userChoice==="rules") {
                console.log("\nRules:\nNuke blows up foot.");
                console.log("Foot crushes cockroach.");
                console.log("Cockroach survives nuke.");
            }
            var userChoice = prompt("Do you choose nuke, foot or cockroach?","Type <rules> to see the rules.").toLowerCase();
        } while (userChoice !="nuke" && userChoice !="foot" && userChoice !="cockroach");
    var computerChoice = Math.random();
    if (computerChoice < 0.2) {
        computerChoice = "nuke";
    } else if (computerChoice <= 0.4) {
        computerChoice = "foot";
    } else if (computerChoice <=0.6) {
    }
    else {
        computerChoice = "cockroach";
    }

    console.log("\nYour choice: "+ userChoice);
    console.log("Computer: " + computerChoice);

    compare(userChoice,computerChoice);
    } while (userChoice === computerChoice);
} while (played <= times-1); // times minus 1 because its a do-loop

console.log("\nFinal Score: "+ score1+":"+score2);
if (score1>score2) {
    console.log("Player 1 is the overall winner!");
}
else if (score2>score1) {
    console.log("The computer is the overall winner!");
}
else {
    console.log("It's a tie after all.");
}


_________________
 Nuke, Foot, Cockroach BAjMdNS

2 Nuke, Foot, Cockroach Empty Re: Nuke, Foot, Cockroach 12/8/2014, 4:53 am

Bully@WiiPlaza

Bully@WiiPlaza
 
 

It's looking better and better, keep it up. Smile


_________________
 Nuke, Foot, Cockroach YBjg74I

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum