Skip to content

Commit

Permalink
Updated scoring & penalty calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
rpufe committed Apr 18, 2024
1 parent bd3edff commit 5b03353
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ public class ThrowInBenchmarkReferee extends BenchmarkRefereeBase
/** distance to ball above which run ends (in m) */
private static final double MAX_BALL_DISTANCE = 2.0;

/** penalty assigned if player leaves circle */
private static final double PENALTY_LEAVING_CIRCLE = 5.0;

/** speed below which the ball is considered in rest (in m/cycle) */
private static final double BALL_STOPPED_SPEED = 0.001;

Expand Down Expand Up @@ -168,16 +165,17 @@ protected boolean onDuringBenchmark()
@Override
protected void onStopBenchmark()
{
// evaluation function
distanceError = oldBallPos.getNorm();
state = RefereeState.STOPPED;

// we give a penalty if player left circle around ball
Vector3D posPlayer = getAgent().getPosition();
Vector2D playerNow = new Vector2D(posPlayer.getX(), posPlayer.getY());
Vector2D ballInitial = new Vector2D(runInfo.getBallX(), runInfo.getBallY());

distanceError = oldBallPos.distance(ballInitial);

// we give a penalty if player left circle around ball
if (playerNow.distance(ballInitial) > MAX_BALL_DISTANCE) {
distanceError += PENALTY_LEAVING_CIRCLE;
distanceError = 0;
hasPenalty = true;
}

Expand Down

0 comments on commit 5b03353

Please sign in to comment.