
com.fathzer.games.ai.experimental.Spy 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.experimental;
import java.util.List;
import com.fathzer.games.MoveGenerator;
import com.fathzer.games.ai.transposition.AlphaBetaState;
import com.fathzer.games.ai.transposition.TranspositionTablePolicy;
/** A spy that can be used to monitor the search process of {@link Negamax3}.
*
It is called by the search process at various points.
* @param The type of the moves
* @param The type of the {@link MoveGenerator} to use
*/
public interface Spy> {
/** The events that triggers the end of search at a depth. */
public enum Event {
/** The search process reached the max depth and computed a new evaluation. */
EVAL,
/** The search process has reached a terminal game state. */
END_GAME,
/** The search process has exited because there are no more moves to play. */
EXIT,
/** The search process has found an evaluation from the transposition table. */
TT
}
/** Called when the search process enters a new depth.
* @param state The state of the search process
*/
default void enter(TreeSearchStateStack state) {}
/** Called when alpha/beta value is found in the transposition table.
* @param state The state of the search process
* @param abState The alpha/beta state
*/
default void alphaBetaFromTT(TreeSearchStateStack state, AlphaBetaState abState) {}
/** Called when a state was sent to the transposition table (even if it is rejected by its {@link TranspositionTablePolicy}
* @param state The state of the search process
* @param abState The alpha/beta state
* @param store true if the state is stored, false if it is rejected by the policy
*/
default void storeTT(TreeSearchStateStack state, AlphaBetaState abState, boolean store) {}
/** Called when a tree cut occurs.
* @param state The state of the search process
* @param move The move that triggered the cut
*/
default void cut(TreeSearchStateStack state, M move) {}
/** Called when the search process exits a depth.
* @param state The state of the search process
* @param evt The event that triggered the exit
*/
default void exit(TreeSearchStateStack state, Event evt) {}
/** Called when a move is unmade.
* @param state The state of the search process
* @param moves The list of moves
* @param move The move that was unmade
*/
default void moveUnmade(TreeSearchStateStack state, List moves, M move) {}
/** Called when the moves are computed.
* @param searchStack The search stack
* @param moves The list of moves
*/
default void movesComputed(TreeSearchStateStack searchStack, List moves) {}
/** Called when an exception is thrown.
* @param searchStack The search stack
* @param e The exception
*/
default void exception(TreeSearchStateStack searchStack, RuntimeException e) {}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy