Curling

import math import random def play_curling(): print("--- 🥌 Welcome to Terminal Curling! 🥌 ---") print("Goal: Get your stone as close to the Button (0.0) as possible.") print("The House (target area) is 6.0 units wide.") # Target is at 0.0 button = 0.0 stone_position = -20.0 # Starting behind the hog line try: power = float(input("Choose Power (1-10): ")) angle = float(input("Choose Angle in degrees (-10 to 10): ")) except ValueError: print("Invalid input. Please enter numbers.") return # Simple Physics Calculation # Travel distance is based on power plus a little random ice friction friction = random.uniform(0.8, 1.2) distance_traveled = (power * 2.5) * friction # Calculate final position relative to the button # Using basic trigonometry for the lateral offset final_y = stone_position + (distance_traveled * math.cos(math.radians(angle))) final_x = distance_traveled * math.sin(math.radians(angle)) # Calculate total distance from the center (0,0) total_distance = math.sqrt(final_x**2 + final_y**2) print(f"\nYour stone slid to position: (Left/Right: {final_x:.2f}, Long/Short: {final_y:.2f})") if total_distance < 0.5: print("⭐ PERFECT SHOT! You're on the button!") elif total_distance < 3.0: print("✅ Nice! You're inside the House.") elif total_distance < 6.0: print("⚪ You're on the edge of the House.") else: print("💨 Out of play! Better luck next end.") if __name__ == "__main__": play_curling()

Comments