import random
def handle_emotions(pressure_level, emotion_state, threshold=8):
"""
處理情緒的函數
Args:
pressure_level (int): 當前壓力程度 (1-10)
emotion_state (str): 情緒狀態 ('positive', 'negative', 'neutral')
threshold (int): 壓力臨界值,默認為8
Returns:
list: 包含情緒建議與安慰行動的列表
"""
thoughts = []
if pressure_level > threshold:
thoughts.append("感覺很有壓力,但請記住這只是暫時的")
else:
thoughts.append("目前壓力在可以處理的範圍,繼續加油!")
if emotion_state == 'negative':
thoughts.append("雖然現在心情不好,但生命很寶貴")
actions = ["買珍奶", "吃雞排", "去散步", "看看喜歡的劇", "跟自己聊聊天"]
action = random.choice(actions)
thoughts.append(f"來{action}吧!會讓你感覺好一點")
elif emotion_state == 'neutral':
thoughts.append("保持平穩的心情也很棒,或許可以試試一些小活動讓自己更放鬆")
elif emotion_state == 'positive':
thoughts.append("心情很好喔!繼續保持!")
else:
thoughts.append("無法識別的情緒狀態,但沒關係,一切都會好起來的!")
thoughts.append("生活總會有起有落,但還有很多美好值得期待")
thoughts.append("珍奶、美食、陽光、朋友... 都是生活中的小確幸")
return thoughts
if __name__ == "__main__":
current_pressure = 9
current_emotion = 'negative'
results = handle_emotions(current_pressure, current_emotion)
print("\n=== 心情整理小幫手 ===")
for thought in results:
print(f"💭 {thought}")
print("記住:活著才能喝珍奶")