ola Luiz,olha esse codigo em python ve se consegue rodar peguei neste site.
https://gimplearn.net/viewtopic.php?f=39&t=2333&p=25624&hilit=wheeling#p25624
#You can change below 4 lines to values you want and run program
#----------------------------------------------------------------
ch = ['1','2','3','4','5','6','7','8','9','10','11','12'] #characters to use as number substitutes for wheeling keys/pattern
if_match = 3 #if we match this number of numbers in our wheel
min_match = 3 #minimum guarantee match
numbers_per_ticket = 6 #numbers on per line on a ticket
# -------------------------------------------------------------
def check(ind,i,group_size,l):
if i >= 0:
ind[i] += 1 #try incrementing it
if ind[i] > (l - 1 - (group_size-1-i)):
return check(ind,i-1,group_size,l)
else:
return i
else:
return i-1
def combinations(li,group_size):
index = [0] * group_size #initialize pointers
for i in range(0,group_size):
index[i] = i
l = len(li)
combs = []
while index[0] <= (l - group_size):
#print ((l - group_size))
#grab combination here
comb = []
#print (index)
for z in range(0,group_size):
comb.append(li[index[z]])
combs.append(tuple(comb))
i = group_size-1
lowestchange = check(index,i,group_size,l)
#print (lowestchange)
for j in range(lowestchange+1,group_size):
k = j - lowestchange
#print (index[j-1]+k,end=",")
index[j]=index[j-1]+1
# print
return combs
def row_match(row1,check1): #returns number of matches check appears in row
count = 0
for item in row1:
if item in check1:
count += 1
return count
dot_count = 1
def row_matches_count(clist,checklist):
global dot_count
for i in range(0,len(checklist)):
#print (".",end="")
dot_count += 1
if dot_count % 100==0:
dot_count = 1
# print ()
checklist[i][1] = 0 #reset checks each time.
for k in range(0,len(clist)):
if clist[k][1] == 0: #not yet included
c = row_match(clist[k][0],checklist[i][0])
if c >= min_match:
#print "match:" + str(c)
checklist[i][1] += 1 #increment counter of rows matched mininum matches.
return clist,checklist;
def allchecked(clist):
for clistrow in clist:
if clistrow[1] == 0:
return False
return True
def markcheck(clist,checkrow):
for clistrow in clist:
if clistrow[1] == 0: #not yet included
c = row_match(clistrow[0],checkrow)
if c >= min_match:
clistrow[1] = 1 #mark it as checked
return clist
# Get all combinations of [1, 2, 3]
# and length 2
comb = combinations(ch, if_match)
comb = list(comb)
#mylist = []
#copy and convert to list
for i in range(0,len(comb)):
comb[i] = [list(comb[i]),0]
#mylist.append([list(comb[i][0]),0])
mylist = combinations(ch,numbers_per_ticket)
mylist = list(mylist)
for i in range(0,len(mylist)):
#comb[i] = [list(comb[i]),0]
mylist[i] = [list(mylist[i]),0]
#match count
keys = []
while not allchecked(comb):
# print ()
# print ("Processing...")
comb,mylist = row_matches_count(comb,mylist)
#print str(mylist)
mylist = sorted(mylist,key=lambda x: -x[1])
keys.append(mylist[0][0]) #add it as key
comb = markcheck(comb,mylist[0][0])
del mylist[0]
#print ()
print ("Resultado possível, compras seguidas pelo número de correspondências")
for i in range(0,len(comb)):
linenum = str(i+1)
# print (linenum+ "-result",end=" ")
checkrow = comb[i][0]
# print ("".join(checkrow),"buys:",end=" ")
# for key in keys:
# c = row_match(checkrow,key)
# print ("".join(key),c,end=" ")
# print ()
#print ("number of key lines:",len(keys))
#print ("Keys:",end=" ")
for key in keys:
print (" ".join(key))
print ()
print (str(len(ch)) + " Numeros, ganha "+str(if_match) + " se " + str(min_match))
print(str(len(keys)) + " Cartões ("+str(numbers_per_ticket)+" Numeros por Cartão).")
print ("Fim!")