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

com.fathzer.games.ai.DepthFirstSearchParameters Maven / Gradle / Ivy

The newest version!
package com.fathzer.games.ai;

/** The parameters of a depth first AI search.
 * @see SearchResult
 */
public class DepthFirstSearchParameters extends SearchParameters {
	private static final String DEPTH_SHOULD_BE_STRICTLY_POSITIVE = "Depth should be strictly positive";

	private int depth;
	
	/** Constructor.
	 * 
By default search size is 1 and accuracy is 0 * @param depth The search depth (must be > 0) * @throws IllegalArgumentException if depth <=0 */ public DepthFirstSearchParameters(int depth) { this(depth, 1, 0); } /** Constructor. * @param depth The search depth (must be > 0) * @param size How many best moves are requested to have an exact value (Integer.MAX_VALUE to have all moves). * @param accuracy the evaluation gap under which two moves are considered as equivalent. *
This allows to obtain moves that are almost equivalent to the last strictly best move. *
This could be useful to prevent the engine to always play the same move for a position. * @throws IllegalArgumentException if depth or size <=0, or accuracy <0 */ public DepthFirstSearchParameters(int depth, int size, int accuracy) { super(size, accuracy); if (depth<=0) { throw new IllegalArgumentException(DEPTH_SHOULD_BE_STRICTLY_POSITIVE); } this.depth = depth; } /** Gets the search depth * @return a positive int */ public int getDepth() { return depth; } /** Sets the search depth. * @param depth The search depth (must be > 0) * @throws IllegalArgumentException if depth <=0 */ public void setDepth(int depth) { if (depth<=0) { throw new IllegalArgumentException(DEPTH_SHOULD_BE_STRICTLY_POSITIVE); } this.depth = depth; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy