Results 1 to 5 of 5
  1. #1
    Secretly Ron Swanson xVO1Dx's Avatar

    Badge

    Join Date
    Mar 2014
    Location
    Indiana
    Posts
    802
    Points
    539
         User Info     Contact     Gamer ID
    Join Date
    Mar 2014
    Location
    Indiana
    Posts
    802
    Points
    539
    Gamer IDs

    Gamertag: xVO1Dx Wii Code: ?VO1D?

    Contact info:

    Youtube Channel: http://www.youtube.com/channel/UCcw94QTGPyNP01t9wQo512Q/feed Kik Username: NinjaMaster64

    Default Fire, Water, or Ice

    Code:
    //Made by VO1D using codecademy.com
    var yourChoice = prompt("Do you choose water, fire, or ice?");
    var cpuChoice = Math.random();
    if (cpuChoice < 0.34) {
    	cpuChoice = "fire";
    } else if(cpuChoice <= 0.67) {
    	cpuChoice = "water";
    } else {
    	cpuChoice = "ice";
    } console.log("Your Opponent Chose: " + cpuChoice);
    
    var compare= function(choice1, choice2){
        if(choice1===choice2){
            return "The result is a tie!"
        } else if(choice1=== "fire"){
            if(choice2==="ice"){
                return "Fire Wins!"
            } else {
                return "Water Wins!"
            }    
        } else if(choice1==="water"){
            if(choice2==="fire"){
                return "Water Wins!"
            } else{
                return "Ice Wins!"
            }
        }
        else if(choice1==="ice"){
            if(choice2==="water"){
                return "Ice Wins!"
            } else {
                return "Fire Wins!"
            }
        }
    }
    console.log(compare(yourChoice, cpuChoice))

    0 Not allowed! Not allowed!


    https://www.youtube.com/channel/UCcw...yNP01t9wQo512Q

    http://pastebin.com/bUTWiTEY
    Last Updated on: June 26, 2015

  2. #2
    Member Kondra's Avatar
    Join Date
    Dec 2014
    Location
    C:\Users\Kondra>
    Posts
    132
    Points
    316
         User Info     Contact     Gamer ID
    Join Date
    Dec 2014
    Location
    C:\Users\Kondra>
    Posts
    132
    Points
    316

    Contact info:

    Youtube Channel: http://www.youtube.com/

    Default

    Python version (got bored..)

    import random
    def Text(Message):
    print(Message)
    return True
    arrayofelements = ['water','fire','ice']
    opponent = random.choice(arrayofelements)
    chose = raw_input("Do you pick water, fire, or ice?")
    if chose == '': pass, exit
    elif chose == 'fire' and opponent == 'water': Text('Opponent wins!')
    elif chose == 'water' and opponent == 'fire': Text('You win!')
    elif chose == 'ice' and opponent == 'fire': Text('Opponent wins!')
    elif chose == 'fire' and opponent == 'ice': Text('You win!')
    elif chose == 'ice' and opponent == 'water': Text('Tie!')
    elif chose == 'water' and opponent == 'ice': Text('Tie!')

    0 Not allowed! Not allowed!
    Last edited by Kondra; 03-01-2015 at 09:13 AM.

  3. #3
    Secretly Ron Swanson xVO1Dx's Avatar

    Badge

    Join Date
    Mar 2014
    Location
    Indiana
    Posts
    802
    Points
    539
         User Info     Contact     Gamer ID
    Join Date
    Mar 2014
    Location
    Indiana
    Posts
    802
    Points
    539
    Gamer IDs

    Gamertag: xVO1Dx Wii Code: ?VO1D?

    Contact info:

    Youtube Channel: http://www.youtube.com/channel/UCcw94QTGPyNP01t9wQo512Q/feed Kik Username: NinjaMaster64

    Default

    Quote Originally Posted by Arctic View Post
    Python version (got bored..)

    import random
    def Text(Message):
    print(Message)
    return True
    arrayofelements = ['water','fire','ice']
    opponent = random.choice(arrayofelements)
    chose = raw_input("Do you pick water, fire, or ice?")
    if chose == '': pass, exit
    elif chose == 'fire' and oppenent == 'water': Text('Oppenent wins!')
    elif chose == 'water' and oppenent == 'fire': Text('You win!')
    elif chose == 'ice' and oppenent == 'fire': Text('Opponent wins!')
    elif chose == 'fire' and opponent == 'ice': Text('You win!')
    elif chose == 'ice' and opponent == 'water': Text('Tie!')
    elif chose == 'water' and opponent == 'ice': Text('Tie!')
    Assuming this works, nice job man

    1 Not allowed! Not allowed!


    https://www.youtube.com/channel/UCcw...yNP01t9wQo512Q

    http://pastebin.com/bUTWiTEY
    Last Updated on: June 26, 2015

  4. #4
    Member Kondra's Avatar
    Join Date
    Dec 2014
    Location
    C:\Users\Kondra>
    Posts
    132
    Points
    316
         User Info     Contact     Gamer ID
    Join Date
    Dec 2014
    Location
    C:\Users\Kondra>
    Posts
    132
    Points
    316

    Contact info:

    Youtube Channel: http://www.youtube.com/

    Default

    same to you :p

    0 Not allowed! Not allowed!

  5. #5
    Nooblet
    Join Date
    Mar 2015
    Posts
    18
    Points
    29
         User Info     Contact     Gamer ID
    Join Date
    Mar 2015
    Posts
    18
    Points
    29

    Contact info:

    Youtube Channel: http://www.youtube.com/

    Default

    They both work! Good job you two!

    0 Not allowed! Not allowed!

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -10. The time now is 08:32 PM.
Powered by vBulletin®
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.