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