Beispiel #1
0
  @Override
  public void processModel(CommandPlayer context, EnvironmentModel model) {
    SeeBallInfo ball = model.getLastPercept().getLastSeenBall();

    double agentAbsAngle = model.getAgentAbsAngleRadians();

    double ballAngle = FastMath.toRadians(ball.getDirection());
    double totalBallAngle = ballAngle + agentAbsAngle;
    double goalAngle = model.getGoalAngle();

    double angleBetweenBallAndGoal = totalBallAngle - goalAngle;

    kickAtGoalAction.takeAction(context, model);
  }
Beispiel #2
0
  /**
   *
   *
   * <ul>
   *   <li>Go to passive state if the ball is outside of movement range
   *   <li>Go to Defending state if the team doesnt have the ball and the agent doesnt have the ball
   *   <li>Go to Support state if the agent doesn't have the ball but the team does have the ball
   * </ul>
   *
   * @param stateMachine State Machine to update.
   * @param model Model containing the current game state.
   */
  @Override
  public void updateState(StateMachine stateMachine, EnvironmentModel model) {

    if (!model.ballInMovementRange() && !model.agentHasBall()) {
      stateMachine.changeState(StateMachine.PASSIVE_STATE, model);
      return;
    }

    if (!model.teamHasBall() && !model.agentHasBall()) {
      stateMachine.changeState(StateMachine.DEFENDING_STATE, model);
      return;
    }

    if (!model.agentHasBall() && model.teamHasBall() && !model.isPlayerGoalKeeper()) {
      stateMachine.changeState(StateMachine.SUPPORT_STATE, model);
    }
  }