Advertisement
Guest User

Untitled

a guest
May 19th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.89 KB | None | 0 0
  1. // import 'dart:async';
  2. import 'dart:math';
  3. import "dart:io" ;
  4.  
  5. void main() {
  6.   Random r =  Random(); // mesma forma de escrever o mesmo codigo
  7.   var random = Random(); // ....
  8.   var tp = ["Cruzeiro", "Bahia", "Palmeiras", "Flamengo"];
  9.   var placar = [0,1,2,3,4,5,6];
  10.   var retorno;   //variavel do readLineSync
  11.  
  12.  
  13.   print("Lista de Times Cadastrados $tp"); //Mostra os times Cadastrados
  14.   retorno = stdin.readLineSync(); // Aperta uma tecla para prosseguir
  15.  
  16.   var time1 = tp.removeAt(r.nextInt(tp.length));
  17.   var time2 = tp.removeAt(r.nextInt(tp.length));
  18.   var time3 = tp.removeAt(r.nextInt(tp.length));
  19.   var time4 = tp.removeAt(r.nextInt(tp.length));
  20.   //Sorteio dos times da lista sem repetiçao
  21.  
  22.   var f1 , f2;  //Finalistas
  23.  
  24.   print("Times Participantes do Torneio $time1, $time2,  $time3, $time4"); // times do torneio
  25.   retorno = stdin.readLineSync();
  26.  
  27.   var pl1 = r.nextInt(6); // numero aleatorio do placar
  28.   var pl2 = r.nextInt(6); // com esse comando nao preciso da variavel placar
  29.   var pl3 = r.nextInt(6);
  30.   var pl4 =  placar[r.nextInt(placar.length)]; // com esse comando preciso da variavel placar
  31.   var plf1 = placar[r.nextInt(placar.length)];
  32.   var plf2 = placar[r.nextInt(placar.length)];
  33.  
  34.  
  35.  
  36.   print("$time1 $pl1 x $pl2 $time2");
  37.   if ( pl1 > pl2) {
  38.       print("$time1 Classificado");
  39.       f1= time1;
  40.    } else { pl1 < pl2;
  41.       print("$time2 Classificado ");
  42.       f1 = time2;
  43.    }
  44.   retorno = stdin.readLineSync();
  45.  
  46.   print("$time3 $pl3 x $pl4 $time4");
  47.   if ( pl3 > pl4) {
  48.       print("$time3 Classificado");
  49.       f2 = time3;
  50.    } else { pl3 < pl4;
  51.       print("$time4 Classificado ");
  52.        f2 = time4;
  53.    }
  54.   retorno = stdin.readLineSync();
  55.  
  56.  
  57.   //final
  58.   print("$f1 $plf1 x $plf2 $f2");
  59.   if ( plf1 > plf2) {
  60.     print("$f1 Campeão!!");
  61.   } else { plf1 < plf2;
  62.   print("$f2 Campeão ");
  63.   }
  64.   retorno = stdin.readLineSync();
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement