
152 views
Simple FLAMES game in Python
The FLAMES game is a simple game that determines the relationship between two people by eliminating common letters in their names and revealing the remaining letters as an acronym (Friend, Lover, Affection, Marriage, Enemy, Sibling). Here’s a Python script to implement the FLAMES game:
def remove_common_letters(name1, name2):
# Convert names to lowercase and remove spaces
name1 = name1.lower().replace(" ", "")
name2 = name2.lower().replace(" ", "")
# Create a set of unique letters in each name
set1 = set(name1)
set2 = set(name2)
# Calculate the total number of unique letters
total_unique_letters = len(set1) + len(set2)
# Calculate the number of common letters
common_letters = 0
for letter in set1:
if letter in set2:
common_letters += 2
return total_unique_letters - common_letters
def flames_relationship(name1, name2):
relationship = "FLAMES"
index = 0
remaining_letters = remove_common_letters(name1, name2)
while len(relationship) > 1:
index = (index + remaining_letters - 1) % len(relationship)
relationship = relationship[:index] + relationship[index + 1:]
return relationship
if __name__ == "__main__":
print("Welcome to the FLAMES game!")
name1 = input("Enter the first name: ")
name2 = input("Enter the second name: ")
result = flames_relationship(name1, name2)
relationship_map = {
'F': 'Friend',
'L': 'Lover',
'A': 'Affection',
'M': 'Marriage',
'E': 'Enemy',
'S': 'Sibling'
}
print(f"The relationship between {name1} and {name2} is: {relationship_map[result]}")
Copy and paste this script into a Python environment, and run it. It will prompt you to enter two names, and then it will determine the relationship between those two names using the FLAMES algorithm.
Remember that the FLAMES game is just for fun and should not be taken seriously as a reflection of any actual relationship.