Skip to content

Commit cdcdfef

Browse files
build: Enable sources and javadoc publishing
1 parent 6ba2da7 commit cdcdfef

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ java {
124124
toolchain {
125125
languageVersion = JavaLanguageVersion.of(jdkVersion)
126126
}
127+
withJavadocJar()
128+
withSourcesJar()
127129
}
128130

129131
// Code formatting (./gradlew spotlessApply)

app/src/main/java/org/xxdc/oss/example/PlayerNode.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public sealed interface PlayerNode extends ToIntFunction<GameState> {
2020
/**
2121
* Gets the player's next move to apply to the game board with the current game state.
2222
*
23-
* @param board to apply the move to
23+
* @param state the current state of the game
2424
* @return the location on the game board where the move was made
2525
*/
2626
public int applyAsInt(GameState state);
@@ -41,7 +41,7 @@ public Local(String playerMarker, P player) {
4141
/**
4242
* Gets the player's next move to apply to the given game board.
4343
*
44-
* @param board the game board to apply the move to
44+
* @param state the current state of the game
4545
* @return the location on the game board where the move was made
4646
*/
4747
@Override
@@ -84,7 +84,7 @@ public Remote(String playerMarker, TransportServer transport) {
8484
/**
8585
* Gets the player's next move to apply to the given game board.
8686
*
87-
* @param board the game board to apply the move to
87+
* @param state the current state of the game
8888
* @return the location on the game board where the move was made
8989
*/
9090
@Override

app/src/main/java/org/xxdc/oss/example/bot/MonteCarloTreeSearch.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
import java.util.stream.Collectors;
1111
import org.xxdc.oss.example.GameState;
1212

13+
/**
14+
* Implements the Monte Carlo Tree Search (MCTS) algorithm for a game bot strategy. The MCTS
15+
* algorithm is used to select the best move for the current game state by simulating random game
16+
* play and backpropagating the results to update the search tree. The algorithm can be configured
17+
* with a maximum time limit and maximum number of iterations.
18+
*/
1319
public final class MonteCarloTreeSearch implements BotStrategy {
1420

1521
private static final Logger log = System.getLogger(MonteCarloTreeSearch.class.getName());
@@ -21,10 +27,23 @@ public final class MonteCarloTreeSearch implements BotStrategy {
2127
private static final double MAX_SCORE = 1.0;
2228
private static final double DRAW_SCORE = 0.0;
2329

30+
/**
31+
* Constructs a new instance of the {@link MonteCarloTreeSearch} class with the given initial game
32+
* state and a default configuration (max time limit of 1 second).
33+
*
34+
* @param state the initial game state to use for the Monte Carlo tree search
35+
*/
2436
public MonteCarloTreeSearch(GameState state) {
2537
this(state, BotStrategyConfig.newBuilder().maxTimeMillis(TimeUnit.SECONDS, 1).build());
2638
}
2739

40+
/**
41+
* Constructs a new instance of the {@link MonteCarloTreeSearch} class with the given initial game
42+
* state and configuration.
43+
*
44+
* @param state the initial game state to use for the Monte Carlo tree search
45+
* @param config the configuration settings for the Monte Carlo tree search
46+
*/
2847
public MonteCarloTreeSearch(GameState state, BotStrategyConfig config) {
2948
this.initialState = state;
3049
this.config = config;

0 commit comments

Comments
 (0)