def listParties(n, colCond, rowCond, guessQuality): parties = [] typingList = getTypingList(rowCond) colTypingList = getTypingList(colCond) chart = ResistanceChart(colTypingList, typingList) guaranteeChart = TypingChart1.ResistanceChart(colTypingList, typingList) print('Using environment: ', colTypingList, '\n VS\n', typingList) print('Using chart: \n', chart.makeResistanceMatrix()) print('of size ', len(chart.getRowTyping()), 'x', len(chart.getColTyping())) print() for party in partyGenerator(n, typingList, chart, guaranteeChart): guarantees = party.getGuaranteedResistCount() tryQuality = resistQuality(guarantees, chart) if tryQuality > guessQuality: print('\nFound party!') print( '-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-' ) print(party.getParty()) print( '-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-' ) print('with quality', tryQuality) print() parties.append(party) return parties, chart
def testTypingChart(attacker, defender): typingList = getTypingList(defender) colTypingList = getTypingList(attacker) chart = ResistanceChart(colTypingList, typingList) print('Chart object: ', chart) chartContent = chart.getChart() print('Chart: ', chartContent) print('Chart values: \n', chart.makeValueMatrix()) print('Corresponding to resistance chart: \n', chart.makeResistanceMatrix()) print('TypingList: ', colTypingList, '\n VS', typingList)
def testGetTypingList(cond): print('TypingList: ', getTypingList(cond))