Skip to content

Commit

Permalink
update web prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
penpen72 committed Nov 10, 2024
1 parent 5f0a8b3 commit b77bc50
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions chicken_party.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

import random

def simulate_chicken_party_chinese(people, year):
"""
Simulate a chicken party each year until all employees leave, with outputs in traditional Chinese.
Args:
people (int): Number of initial employees.
year (int): The starting year.
Returns:
str: Summary of the simulation in traditional Chinese.
"""
initial_people = people
years_passed = 0

while people > 0:
# Display party information in traditional Chinese
print(f"年份: {year}, 參加人數: {people}")
print("舉辦chicken party中...")

# Simulate whether someone leaves
if random.random() < 0.5 * people: # Adjusted probability for more realism
people -= 1
print("有人離開了派對。")
else:
print("每個人都留下了。")

# Increment year and calculate years passed
year += 1
years_passed += 1

return f"共有{initial_people}人在{years_passed}年內全部離職。"

# Example usage
simulate_chicken_party_chinese(5, 2013)

0 comments on commit b77bc50

Please sign in to comment.