#/bin/python
class JiuGG:
def __init__(self):
self.imap = {}
self.pos5=0
self.pos1=0
self.pos2=0
self.pos3=0
self.pos4=0
self.pos7=0
def getalist(self,curr,summ):
isets=[]
for i in range(summ//2+1):
if( i == curr ):
continue
for j in range(9,summ//2,-1):
if( j == curr ):
continue
if(i+j == summ):
isets.append([i,j])
if(len(isets)>0):
return isets
else:
return None
def initialimap(self):
for i in range(1,6):
isets=self.getalist(i,15-i)
if(len(isets) > 0):
self.imap[i]=isets
def is1379(self,sets,number):
for asset in sets:
if( number in asset ):
continue
elif ( (10 - number) in asset):
return True
return False
def printJiuGG(self):
self.initialimap()
fir3=[]
firl=[]
firc=[]
for i in self.imap:
if(len(self.imap[i]) == 4):
self.pos5=i
elif(len(self.imap[i]) == 3 and self.pos1 == 0):
self.pos1=i
fir3=self.imap[i]
for ele in fir3:
if(5 in ele):
continue
elif(len(firl) == 0):
firl = ele
else:
firc = ele
for aIn in firl:
if(aIn == self.pos1 ):
continue
elif( self.is1379(fir3,aIn) ):
self.pos3 = aIn
else:
self.pos2 = aIn
for aIn in firc:
if( aIn == self.pos1 ):
continue
elif( self.is1379(fir3,aIn) ):
self.pos7 = aIn
else:
self.pos4 = aIn
print("Print Result:")
print(self.pos1, " - ", self.pos2, " - ", self.pos3)
print(self.pos4, " - ", self.pos5, " - ", 10-self.pos4)
print(self.pos7, " - ", 10-self.pos2, " - ", 10-self.pos1)