Created
December 21, 2011 01:01
-
-
Save yugi386/1504050 to your computer and use it in GitHub Desktop.
Todos os Jogos da Loto fácil - All Games Loto easy
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
$mapa = ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25'] | |
$xmap1 = Array.new | |
$xmap2 = Array.new | |
$xmap3 = Array.new | |
$xmap4 = Array.new | |
# ---------------------------------------------------------------------------- | |
def formata(palavra) | |
if palavra.size != 2 | |
palavra = "0" + palavra | |
end | |
return palavra | |
end | |
# ---------------------------------------------------------------------------- | |
def formata2(palavra) | |
while TRUE | |
if palavra.size != 7 | |
palavra = "0" + palavra | |
else | |
break | |
end | |
end | |
return palavra | |
end | |
# ---------------------------------------------------------------------------- | |
def hora() | |
# obtém a data e hora atual usando o método new | |
agora = Time.new | |
# exibe o resultado | |
puts agora.strftime("%d/%m/%Y - %H:%M:%S") | |
return agora.strftime("%d/%m/%Y - %H:%M:%S") | |
end | |
# ----------------------------------------------------------------------------- | |
def mapa(fator) | |
# Mapeamento de Jogadas | |
if fator == 1 | |
$xmap1 = ["01","02","03","04","05"] | |
xfat = 0 | |
elsif fator == 2 | |
$xmap1 = ["06","07","08","09","10"] | |
xfat = 5 | |
elsif fator == 3 | |
$xmap1 = ["11","12","13","14","15"] | |
xfat = 10 | |
elsif fator == 4 | |
$xmap1 = ["16","17","18","19","20"] | |
xfat = 15 | |
elsif fator == 5 | |
$xmap1 = ["21","22","23","24","25"] | |
xfat = 20 | |
end | |
posic = 0 | |
for cont in (0..4) | |
for cont2 in (0..4) | |
if cont != cont2 | |
t1 = cont2 + 1 + xfat | |
t2 = cont + 1 + xfat | |
tmp = formata(t1.to_s) + " " + formata(t2.to_s) | |
verifica = 0 | |
tot = $xmap2.length | |
tot = tot - 1 | |
if tot < 0 | |
tot = 0 | |
end | |
for cont3 in (0..tot) | |
if tmp == $xmap2[cont3] | |
verifica = 1 | |
end | |
end | |
tmp = formata(t2.to_s) + " " + formata(t1.to_s) | |
for cont3 in (0..tot) | |
if tmp == $xmap2[cont3] | |
verifica = 1 | |
end | |
end | |
if verifica == 0 | |
$xmap2[posic] = $xmap1[cont] + " " + $xmap1[cont2] | |
posic = posic + 1 | |
end | |
end | |
end | |
end | |
if fator == 1 | |
$xmap3 = ["01 02 03 04","01 02 03 05","01 02 04 05","01 03 04 05","02 03 04 05"] | |
elsif fator == 2 | |
$xmap3 = ["06 07 08 09","06 07 08 10","06 07 09 10","06 08 09 10","07 08 09 10"] | |
elsif fator == 3 | |
$xmap3 = ["11 12 13 14","11 12 13 15","11 12 14 15","11 13 14 15","12 13 14 15"] | |
elsif fator == 4 | |
$xmap3 = ["16 17 18 19","16 17 18 20","16 17 19 20","16 18 19 20","17 18 19 20"] | |
elsif fator == 5 | |
$xmap3 = ["21 22 23 24","21 22 23 25","21 22 24 25","21 23 24 25","22 23 24 25"] | |
end | |
if fator == 1 | |
$xmap4 = ["01 02 03 04 05"] | |
elsif fator == 2 | |
$xmap4 = ["06 07 08 09 10"] | |
elsif fator == 3 | |
$xmap4 = ["11 12 13 14 15"] | |
elsif fator == 4 | |
$xmap4 = ["16 17 18 19 20"] | |
elsif fator == 5 | |
$xmap4 = ["21 22 23 24 25"] | |
end | |
end | |
# ----------------------------------------------------------------------------- | |
# Mapeando vet... | |
c1 = 1 | |
c2 = 1 | |
c3 = 1 | |
posic = 0 | |
vet = Array.new | |
while TRUE | |
if c1 != c2 && c1 != c3 && c2 != c3 | |
vet[posic] = formata(c1.to_s) + " " + formata(c2.to_s) + " " + formata(c3.to_s) | |
posic = posic + 1 | |
end | |
c1 = c1 + 1 | |
if c1 > 25 | |
c1 = 1 | |
c2 = c2 + 1 | |
if c2 > 25 | |
c2 = 1 | |
c3 = c3 + 1 | |
if c3 > 25 | |
break | |
end | |
end | |
end | |
end | |
total = vet.length | |
peso = [7,9,17,34,68,136,272,544,1100,2195,4389,8876,17655,36000,71310,142700,285320,570660,1200000,2341299,4682598,9365196,18730395,37460999,89700600] | |
vet2 = Array.new | |
total.times do | |
vet2 << [] | |
end | |
cont = 0 | |
vet.each do |tmp| | |
vet2[cont][0] = tmp | |
t1 = tmp[0,2].to_i - 1 | |
t2 = tmp[3,2].to_i - 1 | |
t3 = tmp[6,2].to_i - 1 | |
vet2[cont][1] = peso[t1] + peso[t2] + peso[t3] | |
cont = cont + 1 | |
end | |
vet2 = vet2.sort do |a,b| | |
a[1] <=> b[1] # indexando pela segunda entrada | |
end | |
vet3 = Array.new | |
posic = 0 | |
cont = 0 | |
marcar = 0 | |
total = total -1 # limite | |
while TRUE | |
if vet2[cont][1] > posic | |
vet3[marcar] = vet2[cont][0] | |
posic = vet2[cont][1] | |
marcar = marcar + 1 | |
end | |
cont = cont + 1 | |
if cont > total | |
break | |
end | |
end | |
totvalido = vet3.length # registros válidos | |
totvalido = totvalido -1 | |
# puts vet.length | |
# puts vet3.length | |
# ----------------------------------------------------------------------- | |
vet0105 = Array.new | |
posic = 0 | |
for cont in (0..totvalido) | |
tmp1 = vet3[cont] | |
t1 = tmp1[0,2].to_i | |
t2 = tmp1[3,2].to_i | |
t3 = tmp1[6,2].to_i | |
if t1 <= 5 && t2 <= 5 && t3 <= 5 | |
vet0105[posic] = vet3[cont] | |
posic = posic + 1 | |
end | |
end | |
mapa(1) | |
for cont in (0..4) | |
vet0105[posic] = $xmap1[cont] | |
posic = posic + 1 | |
end | |
tam = $xmap2.length | |
tam = tam - 1 | |
for cont in (0..tam) | |
vet0105[posic] = $xmap2[cont] | |
posic = posic + 1 | |
end | |
tam = $xmap3.length | |
tam = tam - 1 | |
for cont in (0..tam) | |
vet0105[posic] = $xmap3[cont] | |
posic = posic + 1 | |
end | |
vet0105[posic] = $xmap4[0] | |
posic = posic + 1 | |
vet0105[posic] = "" | |
# ----------------------------------------------------------------------- | |
vet0610 = Array.new | |
posic = 0 | |
for cont in (0..totvalido) | |
tmp1 = vet3[cont] | |
t1 = tmp1[0,2].to_i | |
t2 = tmp1[3,2].to_i | |
t3 = tmp1[6,2].to_i | |
if t1 > 5 && t1 <=10 && t2 > 5 && t2 <= 10 && t3 > 5 && t3 <= 10 | |
vet0610[posic] = vet3[cont] | |
posic = posic + 1 | |
end | |
end | |
mapa(2) | |
for cont in (0..4) | |
vet0610[posic] = $xmap1[cont] | |
posic = posic + 1 | |
end | |
tam = $xmap2.length | |
tam = tam - 1 | |
for cont in (0..tam) | |
vet0610[posic] = $xmap2[cont] | |
posic = posic + 1 | |
end | |
tam = $xmap3.length | |
tam = tam - 1 | |
for cont in (0..tam) | |
vet0610[posic] = $xmap3[cont] | |
posic = posic + 1 | |
end | |
vet0610[posic] = $xmap4[0] | |
posic = posic + 1 | |
vet0610[posic] = "" | |
# ----------------------------------------------------------------------- | |
vet1115 = Array.new | |
posic = 0 | |
for cont in (0..totvalido) | |
tmp1 = vet3[cont] | |
t1 = tmp1[0,2].to_i | |
t2 = tmp1[3,2].to_i | |
t3 = tmp1[6,2].to_i | |
if t1 > 10 && t1 <=15 && t2 > 10 && t2 <= 15 && t3 > 10 && t3 <= 15 | |
vet1115[posic] = vet3[cont] | |
posic = posic + 1 | |
end | |
end | |
mapa(3) | |
for cont in (0..4) | |
vet1115[posic] = $xmap1[cont] | |
posic = posic + 1 | |
end | |
tam = $xmap2.length | |
tam = tam - 1 | |
for cont in (0..tam) | |
vet1115[posic] = $xmap2[cont] | |
posic = posic + 1 | |
end | |
tam = $xmap3.length | |
tam = tam - 1 | |
for cont in (0..tam) | |
vet1115[posic] = $xmap3[cont] | |
posic = posic + 1 | |
end | |
vet1115[posic] = $xmap4[0] | |
posic = posic + 1 | |
vet1115[posic] = "" | |
# ----------------------------------------------------------------------- | |
vet1620 = Array.new | |
posic = 0 | |
for cont in (0..totvalido) | |
tmp1 = vet3[cont] | |
t1 = tmp1[0,2].to_i | |
t2 = tmp1[3,2].to_i | |
t3 = tmp1[6,2].to_i | |
if t1 > 15 && t1 <=20 && t2 > 15 && t2 <= 20 && t3 > 15 && t3 <= 20 | |
vet1620[posic] = vet3[cont] | |
posic = posic + 1 | |
end | |
end | |
mapa(4) | |
for cont in (0..4) | |
vet1620[posic] = $xmap1[cont] | |
posic = posic + 1 | |
end | |
tam = $xmap2.length | |
tam = tam - 1 | |
for cont in (0..tam) | |
vet1620[posic] = $xmap2[cont] | |
posic = posic + 1 | |
end | |
tam = $xmap3.length | |
tam = tam - 1 | |
for cont in (0..tam) | |
vet1620[posic] = $xmap3[cont] | |
posic = posic + 1 | |
end | |
vet1620[posic] = $xmap4[0] | |
posic = posic + 1 | |
vet1620[posic] = "" | |
# ----------------------------------------------------------------------- | |
vet2125 = Array.new | |
posic = 0 | |
for cont in (0..totvalido) | |
tmp1 = vet3[cont] | |
t1 = tmp1[0,2].to_i | |
t2 = tmp1[3,2].to_i | |
t3 = tmp1[6,2].to_i | |
if t1 > 20 && t1 <=25 && t2 > 20 && t2 <= 25 && t3 > 20 && t3 <= 25 | |
vet2125[posic] = vet3[cont] | |
posic = posic + 1 | |
end | |
end | |
mapa(5) | |
for cont in (0..4) | |
vet2125[posic] = $xmap1[cont] | |
posic = posic + 1 | |
end | |
tam = $xmap2.length | |
tam = tam - 1 | |
for cont in (0..tam) | |
vet2125[posic] = $xmap2[cont] | |
posic = posic + 1 | |
end | |
tam = $xmap3.length | |
tam = tam - 1 | |
for cont in (0..tam) | |
vet2125[posic] = $xmap3[cont] | |
posic = posic + 1 | |
end | |
vet2125[posic] = $xmap4[0] | |
posic = posic + 1 | |
vet2125[posic] = "" | |
# ----------------------------------------------------------------------- | |
cont1 = -1 | |
cont2 = 0 | |
cont3 = 0 | |
cont4 = 0 | |
cont5 = 0 | |
t1 = vet0105.length - 1 | |
t2 = vet0610.length - 1 | |
t3 = vet1115.length - 1 | |
t4 = vet1620.length - 1 | |
t5 = vet2125.length - 1 | |
=begin | |
puts t1 | |
puts t2 | |
puts t3 | |
puts t4 | |
puts t5 | |
vet0105.each do |tmp| | |
puts tmp + " | " + tmp.size.to_s | |
end | |
=end | |
dest = File.new("saida.txt","w+") # Cria destino | |
inicio = hora() | |
posic = 0 | |
contador = 0 | |
while TRUE | |
contador = contador + 1 | |
if contador % 100000 == 0 | |
puts inicio + " | " + posic.to_s + " | " + contador.to_s | |
end | |
cont1 = cont1 + 1 | |
if cont1 > t1 | |
cont1 = 0 | |
cont2 = cont2 + 1 | |
if cont2 > t2 | |
cont2 = 0 | |
cont3 = cont3 + 1 | |
if cont3 > t3 | |
cont3 = 0 | |
cont4 = cont4 + 1 | |
if cont4 > t4 | |
cont4 = 0 | |
cont5 = cont5 + 1 | |
if cont5 > t5 | |
break | |
end | |
end | |
end | |
end | |
end | |
tmp1 = vet0105[cont1] | |
tmp2 = vet0610[cont2] | |
tmp3 = vet1115[cont3] | |
tmp4 = vet1620[cont4] | |
tmp5 = vet2125[cont5] | |
texto = "" | |
if tmp1.strip != "" | |
texto = texto + tmp1 + " " | |
end | |
if tmp2.strip != "" | |
texto = texto + tmp2 + " " | |
end | |
if tmp3.strip != "" | |
texto = texto + tmp3 + " " | |
end | |
if tmp4.strip != "" | |
texto = texto + tmp4 + " " | |
end | |
if tmp5.strip != "" | |
texto = texto + tmp5 | |
end | |
texto = texto.strip | |
texto = texto.tr_s(" "," ") | |
if texto.size != 44 | |
next | |
end | |
# Gravando Arquivo: | |
posic = posic + 1 | |
dest.write(formata2(posic.to_s) + ": ") | |
dest.write(texto + "\n") | |
end | |
puts inicio | |
hora() | |
dest.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment