Javascript shitty thing

by Yoko

Yoko
Uguu
Waifu
Posts: 1,393
Threads: 78
Joined: Feb 2016
Reputation: 1
04-06-2016, 12:12 PM
#55949 (1)
Still learning the basic shit but yeah figured out how to make a simple RPS game


Go try it on jsfiddle if you want and/or tell me how I can make it better ;_;
https://jsfiddle.net/

Code:
var choice = prompt("Do you choose rock, paper, or scissors?");
var compchoice = Math.random();

if (compchoice < .34) {
   compchoice = "rock";
}
else if (compchoice <= .67) {
   compchoice = "paper";
}
else {
   compchoice = "scissors";
}
document.write("Computer: " + compchoice + "<br>");

if (compchoice === choice) {
   document.write("It's a tie");
}
else if (choice === "rock") {
   if (compchoice === "paper") {
       document.write("You have lost");
   }
   else {
       document.write("You have won");
   }
}
else if (choice === "paper") {
   if (compchoice === "rock") {
       document.write("You have won");
   }
   else {
       document.write("You have lost");
   }
}
else if (choice === "scissors") {
   if (compchoice === "paper") {
       document.write("You have won");
   }
   else {
       document.write("You have lost");
   }
}

[Image: 687474703a2f2f693135302e70686f746f627563...672e706e67]

Neebs
Waifu
Waifu
Posts: 78
Threads: 11
Joined: Apr 2016
Reputation: 0
04-06-2016, 12:24 PM
#55951 (2)
[Image: 687474703a2f2f692e696d6775722e636f6d2f4d...592e706e67]



For some reason its not working? Idk what I did wrong. I need tech support.

[Image: 687474703a2f2f34352e6d656469612e74756d62...302e676966]
Yoko
Uguu
Waifu
Posts: 1,393
Threads: 78
Joined: Feb 2016
Reputation: 1
04-06-2016, 12:25 PM
#55952 (3)
(04-06-2016, 12:24 PM)Neebs Wrote: [Image: 687474703a2f2f692e696d6775722e636f6d2f4d...592e706e67]



For some reason its not working? Idk what I did wrong. I need tech support.

REAL MATURE AMIGO

[Image: 687474703a2f2f693135302e70686f746f627563...672e706e67]

Aiba
Unregistered
 
04-06-2016, 12:25 PM
#55953 (4)
Or you could have just used the php version on this forum
Yoko
Uguu
Waifu
Posts: 1,393
Threads: 78
Joined: Feb 2016
Reputation: 1
04-06-2016, 12:26 PM
#55954 (5)
(04-06-2016, 12:25 PM)Aiba Wrote: Or you could have just used the php version on this forum

Wat? Have you never heard of practice?

[Image: 687474703a2f2f693135302e70686f746f627563...672e706e67]

Aiba
Unregistered
 
04-06-2016, 12:56 PM
#55950 (6)
(04-06-2016, 12:26 PM)Yoko Wrote:
(04-06-2016, 12:25 PM)Aiba Wrote: Or you could have just used the php version on this forum

Wat? Have you never heard of practice?

coulda made something more useful imo
Yoko
Uguu
Waifu
Posts: 1,393
Threads: 78
Joined: Feb 2016
Reputation: 1
04-06-2016, 01:04 PM
#55955 (7)
(04-06-2016, 12:56 PM)Aiba Wrote:
(04-06-2016, 12:26 PM)Yoko Wrote: Wat? Have you never heard of practice?

coulda made something more useful imo

Wut, that wasn't the point though. I am a complete noob at js and that is like all I could make lol
I'm just trying to practice and was just showing off the shitty thing I made
I couldn't make anything useful even if I wanted to ;_;

[Image: 687474703a2f2f693135302e70686f746f627563...672e706e67]

Neebs
Waifu
Waifu
Posts: 78
Threads: 11
Joined: Apr 2016
Reputation: 0
04-06-2016, 01:08 PM
#55956 (8)
(04-06-2016, 01:04 PM)Yoko Wrote:
(04-06-2016, 12:56 PM)Aiba Wrote: coulda made something more useful imo

Wut, that wasn't the point though. I am a complete noob at js and that is like all I could make lol
I'm just trying to practice and was just showing off the shitty thing I made
I couldn't make anything useful even if I wanted to ;_;

You have too practicing im too lazy usually to do programming so im really rusty. Im really good with linux stuff though. Try python its pretty easy to learn. 


Also check this out Magical land of knowledge

[Image: 687474703a2f2f34352e6d656469612e74756d62...302e676966]
Yoko
Uguu
Waifu
Posts: 1,393
Threads: 78
Joined: Feb 2016
Reputation: 1
04-06-2016, 01:11 PM
#55957 (9)
(04-06-2016, 01:08 PM)Neebs Wrote:
(04-06-2016, 01:04 PM)Yoko Wrote: Wut, that wasn't the point though. I am a complete noob at js and that is like all I could make lol
I'm just trying to practice and was just showing off the shitty thing I made
I couldn't make anything useful even if I wanted to ;_;

You have too practicing im too lazy usually to do programming so im really rusty. Im really good with linux stuff though. Try python its pretty easy to learn. 


Also check this out Magical land of knowledge

Javascript is da coolest language tho

And nice link thanks

[Image: 687474703a2f2f693135302e70686f746f627563...672e706e67]

Neebs
Waifu
Waifu
Posts: 78
Threads: 11
Joined: Apr 2016
Reputation: 0
04-06-2016, 01:22 PM
#55960 (10)
(04-06-2016, 01:11 PM)Yoko Wrote:
(04-06-2016, 01:08 PM)Neebs Wrote: You have too practicing im too lazy usually to do programming so im really rusty. Im really good with linux stuff though. Try python its pretty easy to learn. 


Also check this out Magical land of knowledge

Javascript is da coolest language tho

And nice link thanks

I personally am really interested in learning C++ for game development stuff but I just am never motivated enough or have alot of stuff going on.

[Image: 687474703a2f2f34352e6d656469612e74756d62...302e676966]
Elm
Senior Member
Kohai
Posts: 402
Threads: 30
Joined: Sep 2016
Reputation: 0
04-06-2016, 03:33 PM
#55969 (11)
I rate this 8/8 m8 cus its gr8
Yoko
Uguu
Waifu
Posts: 1,393
Threads: 78
Joined: Feb 2016
Reputation: 1
04-07-2016, 10:05 PM
#56063 (12)
made a little function to help u find the area of a triangle if you know the sides
ya I'm bad ;_;

Code:
// gives you the area of a triangle if you know all 3 sides
var triarea = function(side1,side2,side3) {
        var p = (side1+side2+side3)/2;
        var a = Math.sqrt(p*(p-side1)*(p-side2)*(p-side3));
        return a;
 }
document.write(triarea(5,6,7));

[Image: 687474703a2f2f693135302e70686f746f627563...672e706e67]

Eli Ayase
Waifu Status: Claimed
Waifu
Posts: 450
Threads: 35
Joined: Feb 2016
Reputation: 0
04-07-2016, 10:45 PM
#56064 (13)
Keep going at it Yoko, the more you practice, the close you get to actually making stuff you wanna make!  :yay:

Spoiler

Every anime will receive a full response after it's finished airing and will be replaced on this list.
Ao no Kanata no Four Rhythm - Ongoing (Reviewed @ep8)
Cat Shit One
Durarara!!
ERASED (Boku dake ga Inai Machi)
Kono Subarashii Sekai ni Shukufuku wo
Schwarzesmarken

Spoiler

You can call this 'Drunk Should You Watch' even though it's not written while under the influence of alcohol, just bad anime.
Maiyoga
Yoko
Uguu
Waifu
Posts: 1,393
Threads: 78
Joined: Feb 2016
Reputation: 1
04-07-2016, 10:52 PM
#56065 (14)
(04-07-2016, 10:45 PM)Eli Ayase Wrote: Keep going at it Yoko, the more you practice, the close you get to actually making stuff you wanna make!  :yay:

Thanks, can't wait to be able to make a loli generator ;_;

[Image: 687474703a2f2f693135302e70686f746f627563...672e706e67]