Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>papier kamien nozyce</title>
- <script type = "text/javascript">
- var userChoice = prompt("Wybierasz papier, kamien, czy nozyce?");
- var computerChoice = Math.random();
- if(computerChoice < .33){
- computerChoice = "kamien";
- }
- else if(computerChoice <= .67){
- computerChoice = "papier";
- }
- else
- {
- computerChoice = "nozyce";
- }
- var porownaj = function(wybor1,wybor2){
- if(wybor1===wybor2){
- return "remis";
- }
- if(wybor1 === "kamien"){
- if(wybor2 === "nozyce"){
- return "kamien wygrywa";
- }
- else{
- return "papier wygrywa";
- }
- }
- if(wybor1 == "papier"){
- if(wybor2 == "kamien"){
- return 'papier wygrywa'
- }
- else{
- return 'nozyce wygrywaja';
- }
- }
- if(wybor1 === "nozyce"){
- if(wybor2 = "kamien"){
- return "kamien wygrywa";
- }
- else{
- return "nozyce wygrywaja";
- }
- }
- }
- porownaj(userChoice,computerChoice);
- </script>
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement