Created
September 10, 2021 12:27
-
-
Save carlosmoretti/26a728413bc815538d9495c315be8264 to your computer and use it in GitHub Desktop.
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
| const icones = [{ | |
| icon: "✊", | |
| beat: "✌️" | |
| }, { | |
| icon: "🖐", | |
| beat: "✊" | |
| }, { | |
| icon: "✌️", | |
| beat: "🖐" | |
| }] | |
| const sortear = () => { | |
| setMensagem("Jo, ken, po...") | |
| setIconeIA(null); | |
| let iconUsuario = icones.find(e => e.icon == icone); | |
| let iconIA = icones.map(e => e.icon)[Math.floor(Math.random() * (3 - 0))]; | |
| setIconeIA(iconIA); | |
| if(iconIA == iconUsuario.beat) | |
| setMensagem("Você venceu!"); | |
| else if(iconIA == iconUsuario.icon) | |
| setMensagem("Empate!"); | |
| else | |
| setMensagem("Você perdeu"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment