Skip to content

Commit ded9b06

Browse files
Merge pull request steam-bell-92#1441 from Kirtan-pc/feature/flames-session-stats
feat(flames): add session statistics on exit
2 parents ba2df8d + c8908b4 commit ded9b06

1 file changed

Lines changed: 39 additions & 9 deletions

File tree

games/FLAMES-Game/FLAMES-Game.py

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@
44

55
def main():
66
global char, choice, count, final, flames, index, mapping, matched_chars, name1, name1_list, name2, name2_list, original_name1, original_name2, result, score, share_text, total_len, valid_game
7+
8+
# Session statistics tracker
9+
session = {
10+
"rounds": 0,
11+
"results": {r: 0 for r in "FLAMES"},
12+
"total_score": 0,
13+
}
14+
15+
mapping = {
16+
'F': {"rel": "Friends", "emoji": "🤝", "metric": "Bond Strength"},
17+
'L': {"rel": "Love", "emoji": "❤️", "metric": "Compatibility Score"},
18+
'A': {"rel": "Affection","emoji": "😊", "metric": "Crush Intensity"},
19+
'M': {"rel": "Marriage", "emoji": "💍", "metric": "Marital Bliss"},
20+
'E': {"rel": "Enemies", "emoji": "😈", "metric": "Rivalry Quotient"},
21+
'S': {"rel": "Siblings", "emoji": "🏠", "metric": "Nuisance Factor"},
22+
}
23+
724
while True:
825
print("\n" + "=" * 50)
926
print("🔥 FLAMES GAME - FIND YOUR RELATIONSHIP STATUS! 🔥")
@@ -71,17 +88,13 @@ def main():
7188
flames.pop(index)
7289

7390
result = flames[0]
74-
75-
mapping = {
76-
'F': {"rel": "Friends", "emoji": "🤝", "metric": "Bond Strength"},
77-
'L': {"rel": "Love", "emoji": "❤️", "metric": "Compatibility Score"},
78-
'A': {"rel": "Affection", "emoji": "😊", "metric": "Crush Intensity"},
79-
'M': {"rel": "Marriage", "emoji": "💍", "metric": "Marital Bliss"},
80-
'E': {"rel": "Enemies", "emoji": "😈", "metric": "Rivalry Quotient"},
81-
'S': {"rel": "Siblings", "emoji": "🏠", "metric": "Nuisance Factor"}
82-
}
8391
final = mapping[result]
8492

93+
# Update session statistics
94+
session["rounds"] += 1
95+
session["results"][result] += 1
96+
session["total_score"] += score
97+
8598
print("\n" + "=" * 50)
8699
print("📝 MATCH REPORT CARD")
87100
print("=" * 50)
@@ -107,6 +120,23 @@ def main():
107120
print("⚠️ Invalid choice. Please enter 'y' or 'n'.")
108121

109122
if choice in ('n', 'no'):
123+
# Display session statistics on exit
124+
if session["rounds"] > 0:
125+
avg = session["total_score"] / session["rounds"]
126+
top = max(session["results"], key=session["results"].get)
127+
print("\n" + "=" * 50)
128+
print("📊 SESSION STATS")
129+
print("=" * 50)
130+
print(f" Total Rounds Played : {session['rounds']}")
131+
print("-" * 50)
132+
for letter, count in session["results"].items():
133+
label = mapping[letter]["rel"]
134+
bar = "█" * session["results"][letter]
135+
print(f" {label:<12}: {count:>2} {bar}")
136+
print("-" * 50)
137+
print(f" Most Common Result : {mapping[top]['rel']} {mapping[top]['emoji']}")
138+
print(f" Avg Score : {avg:.1f}%")
139+
print("=" * 50)
110140
print("\n👋 Thanks for playing FLAMES! Goodbye!")
111141
break
112142

0 commit comments

Comments
 (0)