Class MaxN
java.lang.Object
org.xxdc.oss.example.bot.MaxN
- All Implemented Interfaces:
BotStrategy
Implements the MaxN bot strategy for a game. The MaxN strategy tries to maximize the score for
the current player, while considering the scores of all other players. It uses a recursive
algorithm to explore the game tree and find the best move.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new MaxN bot strategy with the given initial game state and default configuration.MaxN(GameState initialState, BotStrategyConfig config) Constructs a new MaxN bot strategy with the given initial game state and configuration. -
Method Summary
Modifier and TypeMethodDescriptionintbestMove()Returns the best move for the current game state.
-
Constructor Details
-
MaxN
Constructs a new MaxN bot strategy with the given initial game state and default configuration.- Parameters:
initialState- the initial game state to use for the bot strategy
-
MaxN
Constructs a new MaxN bot strategy with the given initial game state and configuration.- Parameters:
initialState- the initial game state to use for the bot strategyconfig- the configuration settings for the bot strategy
-
-
Method Details
-
bestMove
public int bestMove()Description copied from interface:BotStrategyReturns the best move for the current game state.- Specified by:
bestMovein interfaceBotStrategy- Returns:
- the index of the best move to make
-