|
| 1 | +#FLAMES GAMES(ANOTHER WAY) |
| 2 | +def eliminateCommonChars(listOne, listTwo) : |
| 3 | + for i in range(len(listOne)) : |
| 4 | + for j in range(len(listTwo)) : |
| 5 | + if listOne[i] == listTwo[j] : |
| 6 | + c = listOne[i] |
| 7 | + listOne.remove(c) |
| 8 | + listTwo.remove(c) |
| 9 | + listThree = listOne + ["*"] + listTwo |
| 10 | + return [listThree, True] |
| 11 | + |
| 12 | + listThree = listOne + ["*"] + listTwo |
| 13 | + return [listThree, False] |
| 14 | + |
| 15 | +# Driver code |
| 16 | +if __name__ == "__main__" : |
| 17 | + playerOne = input("First Player Name : ") |
| 18 | + playerOne = playerOne.lower() |
| 19 | + playerOne.replace(" ", "") |
| 20 | + playerOneList = list(playerOne) |
| 21 | + |
| 22 | + playerTwo = input("Second Player Name : ") |
| 23 | + playerTwo = playerTwo.lower() |
| 24 | + playerTwo.replace(" ", "") |
| 25 | + playerTwoList = list(playerTwo) |
| 26 | + |
| 27 | + proceed = True |
| 28 | + |
| 29 | + while proceed : |
| 30 | + retList = eliminateCommonChars(playerOneList, playerTwoList) |
| 31 | + conList = retList[0] |
| 32 | + proceed = retList[1] |
| 33 | + starIndex = conList.index("*") |
| 34 | + |
| 35 | + playerOneList = conList[ : starIndex] |
| 36 | + playerTwoList = conList[starIndex + 1 : ] |
| 37 | + |
| 38 | + theCount = len(playerOneList) + len(playerTwoList) |
| 39 | + |
| 40 | + # list of FLAMES acronym |
| 41 | + res = ["Friends", "Lovers", "Affectionate", "Marriage", "Enemies", "Siblings"] |
| 42 | + |
| 43 | + while len(res) > 1 : |
| 44 | + splitIndex = (theCount % len(res) - 1) |
| 45 | + if splitIndex >= 0 : |
| 46 | + right = res[splitIndex + 1 : ] |
| 47 | + left = res[ : splitIndex] |
| 48 | + res = right + left |
| 49 | + else : |
| 50 | + res = res[ : len(res) - 1] |
| 51 | + |
| 52 | + # print final result |
| 53 | + print("Relationship Status :", res[0]) |
0 commit comments