This file contains 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
novo_jogo = "s" | |
while novo_jogo == "s" | |
puts "Advinhe o número que estou pensando entre 1 e 100:" | |
seu_numero = gets.to_i | |
pc_numero = Random.rand(99) + 1 | |
tentativas = 1 |
This file contains 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
# coding: utf-8 | |
novo_jogo = "s" | |
while novo_jogo == "s" | |
# Cria a lista de palavras e sorteia uma para o jogo | |
palavras = %w{cachorro gato camelo formiga girafa ornitorrinco lhama morcego camundongo dromedario} | |
palavra_sorteada = palavras.sample | |
palavra_tamanho = palavra_sorteada.size |
This file contains 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
# coding: utf-8 | |
agenda = { | |
Ana: '8989-8989', | |
Clara: '8787-8787', | |
Pedro: '2323-2323' | |
} | |
while true | |
puts "" |
This file contains 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
def calcula_vencedor(sua_escolha, pc_escolha) | |
resultado = (sua_escolha - pc_escolha) % 3 | |
if resultado == 1 | |
'Você ganhou!' | |
elsif resultado == 2 | |
'PC Ganhou!' | |
else | |
'Deu empate!' | |
end |
This file contains 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
class Monstro | |
attr_accessor :energia, :ataque, :vivo | |
def initialize | |
self.energia = Random.rand(10) + 6 | |
self.vivo = true | |
end | |
def bater(alvo) | |
if alvo.esta_vivo? |
This file contains 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
## CHEAT SHEET | |
OBS: Some shortcuts may vary depending on the OS, Text editor, or previous configuration. | |
GENERAL | |
Insert line | |
below: ctrl+enter | |
above: ctrl+shift+Enter | |
Reopen last closed tab: ctrl+shift+t |
This file contains 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
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<style> | |
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } | |
</style> | |
</head> | |
<body> |