A Pen by Diego Loiola on CodePen.
Created
April 6, 2021 19:04
-
-
Save diegoamloiola/17e038ca6fe5a6aceb3fd6140f17c379 to your computer and use it in GitHub Desktop.
Mentalista Aula 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 5<html> | |
| <head> | |
| <title> | |
| Imersão Dev - Aula 03 | |
| </title> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <h1 class="page-title"> | |
| Seja um Mentalista | |
| </h1> | |
| <img src="https://www.alura.com.br/assets/img/imersoes/dev-2021/logo-imersao-calculadora.svg" class="page-logo" alt=""> | |
| </div> | |
| <a href="https://alura.com.br/" target="_blank"> | |
| <img src="https://www.alura.com.br/assets/img/home/alura-logo.svg" alt="" class="alura-logo"> | |
| </a> | |
| <h2></h2> | |
| <h3></h3> | |
| <h4></h4> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var rodadas = parseInt(prompt("Quantas rodadas deseja jogar?")); | |
| var rodada = rodadas; | |
| var tentativas = 3; | |
| var cont1 = 0; | |
| var cont2 = 0; | |
| while (rodadas > 0) { | |
| var numeroAletorio = Math.floor(Math.random() * 15 + 1); | |
| tentativas = 3; | |
| while (tentativas > 0 && rodadas > 0) { | |
| var chute = parseInt(prompt("Digite um numero entre 0 e 15")); | |
| if (chute == numeroAletorio) { | |
| alert("Acertou!"); | |
| cont1++; | |
| break; | |
| } else if (chute < numeroAletorio) { | |
| alert("O número secreto é maior"); | |
| tentativas--; | |
| if (tentativas == 0) { | |
| cont2++; | |
| } | |
| } else if (chute > numeroAletorio) { | |
| alert("O número secreto é menor"); | |
| tentativas--; | |
| if (tentativas == 0) { | |
| cont2++; | |
| } | |
| } | |
| } | |
| rodadas--; | |
| } | |
| document.write("<h2>Rodadas Jogadas: " + rodada + "</h2>"); | |
| document.write("<h3>Rodadas Ganhas: " + cont1 + "</h3>"); | |
| document.write("<h4>Rodadas Perdidas:" + cont2 + "</h4>"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| font-family: "Roboto Mono", monospace; | |
| min-height: 854px; | |
| background-image: url("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRbqfvd9Qn-yOOZNu-urGG9fQX05AtADS4u8INB9uEkFdgCBF0N2L7RtlPfFKZpf3s1Fqc&usqp=CAU"); | |
| background-color: #000000; | |
| background-size: cover; | |
| background-position: center top; | |
| background-repeat: no-repeat; | |
| } | |
| .container { | |
| text-align: center; | |
| padding: 20px; | |
| height: 100vh; | |
| } | |
| .page-title { | |
| color: #ffffff; | |
| margin: 0 0 5px; | |
| } | |
| .page-subtitle { | |
| color: #ffffff; | |
| margin-top: 5px; | |
| } | |
| .page-logo { | |
| width: 200px; | |
| } | |
| h2 { | |
| position: absolute; | |
| font-size: 18px; | |
| font-weight: bold; | |
| color: #000000; | |
| top: 142px; | |
| left: calc(50% - 72.5px); | |
| width: 145px; | |
| text-align: center; | |
| } | |
| h3 { | |
| position: absolute; | |
| font-size: 18px; | |
| font-weight: bold; | |
| color: #008000; | |
| top: 183px; | |
| left: calc(50% - 72.5px); | |
| width: 145px; | |
| text-align: center; | |
| } | |
| h4 { | |
| position: absolute; | |
| font-size: 18px; | |
| font-weight: bold; | |
| color: #ff0000; | |
| top: 220px; | |
| left: calc(50% - 72.5px); | |
| width: 145px; | |
| text-align: center; | |
| } | |
| .alura-logo { | |
| width: 40px; | |
| position: absolute; | |
| top: 10px; | |
| right: 10px; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment