Created
December 25, 2015 23:54
-
-
Save PascalR2014/f1c3df9a43fa519f2a1a to your computer and use it in GitHub Desktop.
Games in javascript, for correction please !
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
var choixUtilisateur = prompt("Choisissez-vous pierre, feuille, ou ciseaux ?"); | |
var choixOrdi = Math.random(); | |
if (choixOrdi < 0.34) { | |
choixOrdi = "pierre"; | |
} else if(choixOrdi <= 0.67) { | |
choixOrdi = "feuille"; | |
} else { | |
choixOrdi = "ciseaux"; | |
console.log("Ordinateur : " + choixOrdi); | |
}*/ | |
// <--Cas d'égalité + var comparer-- | |
var comparer = function(choix1, choix2) { | |
if(choix1 === choix2) { | |
return ("Egalité !"); | |
} | |
// <--1-choix la pierre vs les ciseaux-- | |
if (choix1 === "pierre"){ | |
} | |
else(choix2 === "ciseaux"){ | |
return ("pierre gagne !"); | |
} | |
// <--1b-choix les ciseaux vs la pierre-- | |
if (choix1 === "ciseaux"){ | |
} | |
else(choix2 === "pierre"){ | |
return ("pierre gagne !"); | |
} | |
// <--2-choix la feuille vs la pierre -- | |
if (choix1 === "feuille"){ | |
} | |
else(choix2 === "pierre"){ | |
return ("feuille gagne !"); | |
} | |
// <--2b-choix la pierre vs la feuille -- | |
if (choix1 === "pierre"){ | |
} | |
else(choix2 === "feuille"){ | |
return ("feuille gagne !"); | |
} | |
// <--3-choix les ciseaux vs la pierre-- | |
if (choix1 === "ciseaux"){ | |
} | |
else(choix2 === "pierre"){ | |
return ("pierre gagne !"); | |
} | |
// <--3b-choix la pierre vs les ciseaux-- | |
if (choix1 === "pierre"){ | |
} | |
else(choix2 === "ciseaux"){ | |
return ("pierre gagne !"); | |
} | |
// --4-choix les ciseaux vs la feuille-- | |
if (choix1 === "ciseaux"){ | |
} | |
else(choix2 === "feuille"){ | |
return ("ciseaux gagnent !"); | |
} | |
// --4b-choix la feuille vs les ciseaux -- | |
if (choix1 === "feuille"){ | |
} | |
else(choix2 === "ciseaux"){ | |
return ("ciseaux gagnent !"); | |
} | |
} | |
//; | |
//<--Fin du code !-- | |
//<-- Query result: SyntaxError: missing before statement |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please give me a correct code for this game !
Stone, Sheet(Leaf), scissors
Thanks a lot for your time !