Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Javascript
- </title>
- <script language="javascript">
- var EH;
- var EM;
- EH=prompt("Elige piedra, papel o tijeras");
- EM=Math.random();
- if (EM<0.34) {
- EM="piedra";}
- else if (EM<0.67) {
- EM="papel";}
- else {EM=tijeras;}
- if (EH="piedra")&&(EM="piedra") {
- alert("Empate");}
- else if (EH="papel")&&(EM="papel") {
- alert("Empate");}
- else if (EH="tijeras")&&(EM="tijeras") {
- alert("Empate");}
- else if(EH="piedra")&&(EM="papel") {
- alert("Derrota");}
- else if(EH="papel")&&(EM="tijeras") {
- alert("Derrota");}
- else if(EH="tijeras")&&(EM="papel") {
- alert("Derrota");}
- else if(EH="piedra")&&(EM="tijeras") {
- alert("Ganas");}
- else if(EH="papel")&&(EM="piedra") {
- alert("Ganas");}
- else alert("Ganas");
- </script>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement