Skip to content

A JassBot using the Monte Carlo Tree Search Method for card prediction. Won 2nd Place in JassBotCompetition

Notifications You must be signed in to change notification settings

JoelNiklaus/JassTheRipper

Repository files navigation

JassTheRipper Build Status

This is a Java client (bot) for the Jass challenge server. It is a fork of the challenge java client.

We use Monte Carlo Tree Search (MCTS) with determinization and domain knowledge to beat the best machine and humand Jass players in the Schieber variant.

Build the app with

./gradlew build

Make sure gradle is installed.

Run this app either with docker:

docker build -t jass-the-ripper . # make sure you are in the root directory of this project

docker run -it --rm -p 80:80 jass-the-ripper # specify the ports if needed (also update the dockerfile)

or gradle:

./gradlew run -Pmyargs=ws://127.0.0.1:3000,1 --no-daemon # change the websocket host and port if needed. The value after the comma is the chosenTeamIndex of the bot to be started

Run specific test

./gradlew test --tests to.joeli.jass.client.strategy.training.ArenaTest.train

Run experiment

./gradlew runExperiment

Run experiment as a background process

nohup ./gradlew runExperiment > nohup.out &

Train network

python3 src/main/java/to/joeli/jass/client/strategy/training/python/train.py 0010 cards/
nohup python3 src/main/java/to/joeli/jass/client/strategy/training/python/train.py 0010 cards/ > nohup.out &

Start REST endpoint:

nohup ./gradlew startServer > nohup.out &

JassTheRipper bots:

HSLU opponents:

Tournament Server available on: https://jass-server.abiz.ch/

UI available on: https://jassteppich.abiz.ch/

This client allows you to easily develop a bot for the Jass challenge.

###Wiki (Server): https://github.com/webplatformz/challenge/wiki

###JassChallenge2017 If you are an enrolled student in switzerland, you are welcome to participate the JassChallenge2017 competition in April '17

---------------------- LINK TO OUR REGISTRATION PAGE ----------------------

Getting started

Clone this repository and start (gradlew run) the Application class:

public class Application {
    //CHALLENGE2017: Set your bot name
    private static final String BOT_NAME = "awesomeJavaBot";
    //CHALLENGE2017: Set your own strategy
    private static final RandomJassStrategy STRATEGY = new RandomJassStrategy();

    private static final String LOCAL_URL = "ws://localhost:3000";

    public static void main(String[] args) throws Exception {
        String websocketUrl = parseWebsocketUrlOrDefault(args);

        Player myLocalPlayer = new Player(BOT_NAME, STRATEGY);
        startGame(websocketUrl, myLocalPlayer, SessionType.TOURNAMENT);
    }
}

The client needs the challenge server to connect to. Clone the challenge server and run npm start. For more information go to Jass challenge server repository.

Implement your own bot

To implement your own bot you need to provide an implementation of the JassStrategy interface:

public interface JassStrategy {
    Mode chooseTrumpf(Set<Card> availableCards, GameSession session);
    Card chooseCard(Set<Card> availableCards, GameSession session);

    default void onSessionStarted(GameSession session) {}
    default void onGameStarted(GameSession session) {}
    default void onMoveMade(Move move, GameSession session) {}
    default void onGameFinished() {}
    default void onSessionFinished() {}
}

Start your own tournament

To test your bot against other bots, such das the random bot, you need to start your own tournament.

  1. start the challenge server: npm start
  2. Browse to http://localhosthost:3000
  3. Enter some user name:

Alt text 4. Enter some tournament name and press Enter

Alt text

  1. Join your bots, they should appear on the next page

Alt text

Contributors

Thanks to fluescher for creating this skeleton.

About

A JassBot using the Monte Carlo Tree Search Method for card prediction. Won 2nd Place in JassBotCompetition

Resources

Stars

Watchers

Forks

Packages

No packages published