Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // import 'dart:async';
- import 'dart:math';
- import "dart:io" ;
- void main() {
- Random r = Random(); // mesma forma de escrever o mesmo codigo
- var random = Random(); // ....
- var tp = ["Cruzeiro", "Bahia", "Palmeiras", "Flamengo"];
- var placar = [0,1,2,3,4,5,6];
- var retorno; //variavel do readLineSync
- print("Lista de Times Cadastrados $tp"); //Mostra os times Cadastrados
- retorno = stdin.readLineSync(); // Aperta uma tecla para prosseguir
- var time1 = tp.removeAt(r.nextInt(tp.length));
- var time2 = tp.removeAt(r.nextInt(tp.length));
- var time3 = tp.removeAt(r.nextInt(tp.length));
- var time4 = tp.removeAt(r.nextInt(tp.length));
- //Sorteio dos times da lista sem repetiçao
- var f1 , f2; //Finalistas
- print("Times Participantes do Torneio $time1, $time2, $time3, $time4"); // times do torneio
- retorno = stdin.readLineSync();
- var pl1 = r.nextInt(6); // numero aleatorio do placar
- var pl2 = r.nextInt(6); // com esse comando nao preciso da variavel placar
- var pl3 = r.nextInt(6);
- var pl4 = placar[r.nextInt(placar.length)]; // com esse comando preciso da variavel placar
- var plf1 = placar[r.nextInt(placar.length)];
- var plf2 = placar[r.nextInt(placar.length)];
- print("$time1 $pl1 x $pl2 $time2");
- if ( pl1 > pl2) {
- print("$time1 Classificado");
- f1= time1;
- } else { pl1 < pl2;
- print("$time2 Classificado ");
- f1 = time2;
- }
- retorno = stdin.readLineSync();
- print("$time3 $pl3 x $pl4 $time4");
- if ( pl3 > pl4) {
- print("$time3 Classificado");
- f2 = time3;
- } else { pl3 < pl4;
- print("$time4 Classificado ");
- f2 = time4;
- }
- retorno = stdin.readLineSync();
- //final
- print("$f1 $plf1 x $plf2 $f2");
- if ( plf1 > plf2) {
- print("$f1 Campeão!!");
- } else { plf1 < plf2;
- print("$f2 Campeão ");
- }
- retorno = stdin.readLineSync();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement