79725347

Date: 2025-08-04 20:14:30
Score: 0.5
Natty:
Report link

Is my angle computation logic correct? Should I normalize angles differently?

As @ravenspoint and @btilly pointed out, calculating precise angles with atan can be prone to floating-point errors in this case, we could compare coordinates directly to check for horizontal, vertical, or 45° diagonal lines.

Given a starting point) at (x1, y1) nd a catcher (target point) at (x2, y2) :

A line with a slope of 1 is a 45° diagonal.

Is my method for selecting the closest player correct? How can I verify it?

Calculating Euclidean distance should be enough.

Is there a more robust way to handle player rotation?

Clockwise rotation looks good.

----

Your code has a few logical issues:

  1. The logic appears to check only the thrower initial direction and stops the turn if no catcher is there on the initial direction

  2. The catcher's new throwing direction seems to be a rotation of the previous thrower's direction. The catcher's new orientation should be the opposite of the direction they received the ball from

  3. The simulation does not seem to remove a player from the field after they have thrown the ball

Here are the animations that demonstrate this logic:

Reasons:
  • Blacklisted phrase (0.5): How can I
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Jih-Chi Lee