Hit the Target: Land the Ball in the Cup
Set the launch angle (5–85°) and speed (20–100%) with the − and + buttons (hold them to change faster) or type a number, then press Launch Ball. The dotted line shows only the start of the path, so you still have to judge where it comes down. Check the wind at the top of the field: the arrow shows which way it blows and the number how hard (1 to 10, or calm). You get 3 balls per cup. Landing it with the 1st ball is worth 300 points, the 2nd 150 and the 3rd 75, plus a streak bonus of 25 for every cup in a row you've hit (counting this one). The ball has to drop in through the open top: the cup's walls are solid. Miss with all three and your streak resets. Either way a new cup, with new wind, appears. New Cup skips the current one, but skipping a cup you haven't finished ends your streak. Points are saved only in your own browser.
The physics behind it
Once the ball leaves the launcher, nothing pushes it forward any more. It is a projectile: it keeps the velocity it was launched with, and the only thing changing that velocity is gravity (plus the wind, which we'll come to). The launch speed and angle split into two parts: a sideways speed (speed × cos angle) and an upward speed (speed × sin angle).
Gravity pulls straight down, so it only changes the upward part. Every tick it takes the same amount off the upward speed: the ball slows as it rises, stops for an instant at the top, then falls faster and faster. The sideways speed stays the same the whole time, because nothing pulls sideways. Put a steady sideways drift together with a steadily changing up-and-down speed and you get the curve every thrown ball follows: a parabola.
How far does it go? On flat ground it lands after time in the air × sideways speed. A steeper throw stays up longer but moves sideways slowly; a flatter throw moves sideways fast but comes down quickly. Working it through gives range = speed² × sin(2 × angle) ÷ gravity. The sin(2 × angle) part is biggest when 2 × angle is 90°, so with no wind 45° throws the farthest for any launch speed. That's the best balance between staying up and moving sideways.
The same formula explains a neat surprise: 30° and 60° land in the same spot (so do 15° and 75°, or 20° and 70°). sin(60°) and sin(120°) are equal, so two angles that add up to 90° give exactly the same range at the same speed. The 60° ball climbs much higher and stays in the air about 1.7 times as long, but it moves sideways slowly enough that it comes down in the same place. That's only exactly true when the ball lands at the height it was launched from. In this game the cup's rim is a little higher than the launcher, so the two paths come close at the cup but aren't identical.
Wind adds a small, steady sideways push. Now the sideways speed isn't constant any more: a tailwind keeps adding to it, a headwind keeps taking it away, and the push adds up the whole time the ball is in the air. The sideways drift from the wind grows with the square of the flight time, so a high lob that stays up 1.7 times longer drifts about 3 times as far. That's why 30° and 60° no longer land together in wind, and why the best angle moves: with the wind behind you, a higher throw that gives it more time to push goes farther than 45°; into the wind, a flatter throw that spends less time fighting it does better. At wind 10 the push is 15% as strong as gravity, sideways.
When the ball hits the cup, it bounces off the wall like a ball off a line: the part of its speed going into the wall is reversed and loses a third of its size (65% comes back), and the part along the wall is kept. The game runs at a fixed 60 steps per second on every screen, and each step is cut into small sub-steps so that even the fastest ball moves less than its own radius between checks and can't slip through a wall. In testing, tens of thousands of flat and steep shots were fired at the walls and rims and none got in through the side, and every one of the 1,554 cup positions and wind levels checked could be hit with an angle between 15° and 75° and a speed between 25% and 95%.
What this simulation simplifies
- There is no air drag. A real ball slows down in the air, which makes its path lopsided (it comes down more steeply than it went up) and makes the best angle a bit lower than 45°.
- The ball is a point with a radius: it doesn't spin, so there's no curve from spin, and it bounces off the cup without rolling.
- The wind is a steady push, the same everywhere and all the time. Real wind gusts, changes with height, and pushes on a ball depending on how fast the ball moves through the air.
- The distances in metres are scaled for the game, not real-world numbers: the gravity and launch speeds are chosen so the throws fit the screen, so you can't use them to work out a real throw.
This is a game inspired by physics, not a scientific tool. See the disclaimer for more.