Untitled
unknown
plain_text
a year ago
1.7 kB
4
Indexable
Never
import random def main(): print("You are a man on the run from the police!") print("You need to make a series of decisions to escape.") distance_covered = 0 police_distance = 0 while distance_covered < 20: print("\nOptions:") print("1. Run") print("2. Hide") print("3. Quit") choice = input("Enter your choice (1/2/3): ") if choice == '1': # Running increases both your distance and the police's distance player_run_distance = random.randint(1, 4) police_run_distance = random.randint(2, 5) distance_covered += player_run_distance police_distance += police_run_distance print(f"You ran {player_run_distance} miles.") print(f"The police ran {police_run_distance} miles.") elif choice == '2': # Hiding decreases the police's distance police_distance -= random.randint(1, 3) print("You hide, but the police are still looking for you.") elif choice == '3': print("You quit the game.") break else: print("Invalid choice. Choose 1, 2, or 3.") print(f"Distance covered: {distance_covered} miles") print(f"Police distance: {police_distance} miles") if police_distance >= distance_covered: print("\nYou've been caught by the police!") break if distance_covered >= 20: print("\nCongratulations! You've successfully escaped from the police!") if __name__ == "__main__": main()