Created
November 21, 2014 02:22
-
-
Save breim/cb655a5024c377b45768 to your computer and use it in GitHub Desktop.
Megasena
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
count = Array.new(60) {| i | i +1} # Array de objetos | |
resultado_mega = [1,21,22,27,32,45] | |
i = 0 | |
data_de_inicio = Time.now | |
valor_do_jogo = 2 | |
array_gerado = [] | |
while array_gerado != resultado_mega do | |
array_gerado = count.sample(6).sort! | |
i+=1 | |
if array_gerado == resultado_mega | |
puts "ACHOOOU" | |
puts "Tentativa numero #{i} - #{array_gerado} - R$ #{valor_do_jogo * i}" | |
data_de_fim = Time.now | |
tempo = data_de_inicio - data_de_fim | |
puts tempo | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment