Beispiel #1
0
def generate_couples(games, participants):

    random.shuffle(participants)
    number_of_participants = len(participants)
    couples = []

    if DEBUG:
        logger.debug("Generating couples from: " + str([str(p) for p in participants]))

    for i in range(number_of_participants // 2):

        couple = Couple(participants[i], participants[number_of_participants - i - 1])

        if is_duplicate(games, couple):
            if DEBUG:
                logger.debug("Duplicate couple: " + str(couple))
        else:
            couples.append(couple)

    return couples
	BoyObjectList.append(Boy(i[0],i[1],i[2],i[3],i[4],i[5]))

for i in girllist:
	GirlObjectList.append(Girl(i[0],i[1],i[2],i[3],i[4]))

for gl in GirlObjectList:
	for by in BoyObjectList:
		logs(gl.name+" is looking guy "+by.name)
		if by.rstatus == gl.rstatus and by.rstatus== "single" and by.is_eligible(gl.maintenance_budget,gl.attractiveness) and gl.is_eligible(by.budget):
			by.set_girlfriend = gl.name
			by.rstatus = "committed"
			gl.set_boyfriend = by.name
			gl.rstatus = "committed"
			print(gl.name+ " is in realtionship with "+by.name)
			logs(gl.name+ " is in realtionship with "+by.name)
			CoupleObjectList.append(Couple(by,gl))
			break





gift(GiftObjectList,CoupleObjectList)
happiness(CoupleObjectList)



CoupleObjectList = sorted(CoupleObjectList,key=lambda x: x.happiness , reverse = False)

print("\n")
print("top 10 least happy couple : ")