Author: Not specified Language: text
Description: For 11 lesson geekbrains (v2) Timestamp: 2018-03-15 17:05:02 +0000
View raw paste Parent paste by: Nickolai Reply
  1. <meta charset="utf-8">
  2. <script>
  3.  
  4. alert("Ч?о б? не ??а?и?? ден?ги на ??ле?к?, давай м? ?ебе покажем ве?о??но??? в?падени? ?азн?? зна?ений");
  5. var arr = [ ];
  6. var rounds = 100;
  7. var zeros = 0;
  8. var i = 0; var j = 0;
  9. var arrRed = [1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36];
  10. var arrBlack = [2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35];
  11. var zero = 0;
  12. var max_length = 0;
  13.  
  14. // ?е?о = 0; ??а?ное = -1; Ч??ное = 1;
  15.  
  16. for (i=0; i<=rounds; i++) {
  17.         arr.push(Math.round(Math.random()*36));
  18. }
  19.  
  20. alert (arr);
  21.  
  22. for (var i in arr) {
  23.         for (var j in arrRed) {
  24.                 if (arr[i] == arrRed[j]) {
  25.                         length = 0;
  26.                         while (i < arr.length && arrRed[j]) {
  27.                                 i++;
  28.                                 length = length + 1;
  29.                         }
  30.  
  31.                         if (length > max_length) {
  32.                                 max_length = length;
  33.                         }
  34.                 }      
  35.         }
  36. }
  37.  
  38. alert (max_length);
  39.  
  40. </script>
View raw paste Parent paste by: Nickolai Reply