
com.fathzer.games.ai.toys.RandomAI Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of games-core Show documentation
Show all versions of games-core Show documentation
A core library to help implement two players games.
The newest version!
package com.fathzer.games.ai.toys;
import java.util.Random;
import com.fathzer.games.MoveGenerator;
import com.fathzer.games.ai.evaluation.Evaluation;
/** A fake AI that randomly chooses a score for each move.
* @param The type of moves
* @param The type of move generator
*/
public class RandomAI> extends BasicAI {
@SuppressWarnings("java:S2245") //Ignores Sonar security hot spot, here Random is safe
/** A random engine instance. */
private static final Random RND = new Random();
/** Constructor.
* @param board The board on which the AI plays
*/
public RandomAI(B board) {
super(board);
}
protected Evaluation getEvaluation(M move) {
return Evaluation.score(RND.nextInt());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy