Skip to content

NaiveOpponent

CodingGlad edited this page Dec 31, 2022 · 3 revisions

public class NaiveOpponent implements Opponent

This naive artificial opponent is mainly used a test subject. It's moves are based on the Java Random class.

@Override public FieldPoint makeMove(SoccerGame game)

Method used for receiving of a pseudo-random move.

  • Parameters: game — of current game.
  • Returns: destination point.

private FieldPoint createRandomPoint(FieldPoint currentPosition)

Method for creation of a point in correct format to check its validity.

  • Parameters: currentPosition — is a current location of ball that's used to make a relative move to it.
  • Returns: FieldPoint in correct format.

@Override public OpponentType getType()

Getter for value of OpponentType.

  • Returns: type of OpponentType.

@Override public String getName()

Getter for name of opponent.

  • Returns: String name of opponent.

@Override public GoalLocationType getGoalLocation()

Getter for value of GoalLocation.

  • Returns: type of GoalLocationType.

Clone this wiki locally