All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fathzer.games.ai.toys.RandomAI Maven / Gradle / Ivy

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