Skip to content

sandorw/mocabogaso

Repository files navigation

mocabogaso

Build Status Coverage Status

mocabogaso is a MOnte CArlo BOard GAme SOlver. It uses Monte Carlo tree search to run computer controlled opponents for board games. It's designed to be pluggable, allowing multiple types of AI to be added to solve many types of board games.

The main abstractions of mocabogaso:

  • GameState: Full representation of a game at an instant in time.
  • GameMove: Transitions between GameStates.
  • GameResult: The end result of a finished game.
  • AIService: Performs searches and selects moves for AI players.

Games currently implemented:

Future plans include Go and Chess, along with an AIService better suited for chess and games with evaluation functions (alpha-beta pruned minimax).

Running the code

You can play a game against the AI via

./gradlew run

This command executes the main function in Mocabogaso.java, shown below:

HexGameState gameState = HexGameState.of(9);
Game<DefaultGameMove, HexGameState> game = new Game<>(gameState);
game.addPlayer("X", PlayerFactory.getNewAIPlayer(gameState, difficulty));
game.addPlayer("O", PlayerFactory.getNewAIAssistedHumanPlayer(gameState));
game.playGame();

By default, you'll play a 9x9 game of Hex in which the AI goes first, taking 4 seconds per move. You can input your moves by entering them in the console, formatted as e.g. A9. If you want help in choosing a move, type hint during your turn. To change the difficulty of the AI, pass in a difficulty argument - one of easy, medium, or hard:

./gradlew run -Pargs=hard

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages