Cool game idea I used made up of contents of Rock, Paper, Scissors


#1

I found a cool thing called Math.floor() which rounds an integer up to a whole number.
So I made a script to allow you to draw a random card from a deck of cards using everything learned in Rock,Paper,Scissors and also using Math.floor()

var drawCard1 = function(number){
number = Math.floor((Math.random() * 13) + 1);

if (number === 11){
    return "J";
}
else if (number === 12){
    return "Q";
}
else if (number === 13){
    return "K";
}
else if (number === 1) {
    return "A";
}
else {
    return number;
}

};
var drawCard2 = function(suit){
suit = Math.floor((Math.random() * 4) + 1);
if (suit === 1){
return " of Diamonds";
}
else if (suit === 2){
return " of Spades";
}
else if (suit === 3){
return " of Clubs";
}
else {
return " of Hearts";
}
};

console.log(drawCard1() + drawCard2());


#2

That's pretty cool. You should make a Joker card. It would be even cooler if you could play actual card games


#3

Well, this is my first day! I'm going to try and do the rest of the course and hopefully I'll learn the techniques to make a Blackjack or poker game, even go fish would be cool!


#4

It's really nice to see people directly applying knowledge from the course into their own projects!

Keep it up guys! :slightly_smiling:


#5