Advertisement
Guest User

Untitled

a guest
Nov 25th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.  
  5. <meta charset="utf-8">
  6. <title>TRATATATA</title>
  7. <script>
  8. var zgaduj = Math.floor((Math.random()*100)+1);
  9. //document.write(zgaduj);
  10. var ilosc = 10;
  11. while((ilosc <=10)&&(ilosc >=0)&&(proba!=zgaduj)){
  12.  
  13.  
  14. var proba = prompt("Wylosowałem liczbę z zakresu od 1 do 100. Masz " + ilosc + " prób, musisz ją odgadnąć");
  15.  
  16.  
  17.  
  18. while(proba!=zgaduj){
  19.  
  20. ilosc--;
  21. if(ilosc == 0){
  22. alert("Przegrałeś");
  23.  
  24. }
  25. else if (ilosc > 0){
  26.  
  27. if(proba>zgaduj){
  28.  
  29. var proba = prompt("Mniej!" + ilosc);
  30. }
  31. else if (proba<zgaduj){
  32. var proba = prompt("Więcej!" + ilosc);
  33. }
  34. else{
  35. var proba = prompt("Nie wpisałeś liczby!" + ilosc);
  36. }
  37. }
  38.  
  39. }
  40.  
  41.  
  42. }
  43. if(proba==zgaduj){
  44. document.write("Wygrałeś!");
  45. }
  46.  
  47.  
  48. </script>
  49. </head>
  50. <body>
  51.  
  52.  
  53.  
  54. </body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement