Skip to content

webplatformz/challenge-client-java

 
 

Repository files navigation

jass-challenge-client-java Build Status

This is a Java client (bot) for the Jass challenge server. 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

https://jass-challenge.zuehlke.io/

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

  1. Join random strategy bots for testing. In your challenge server directory enter the command: npm run bot:start This will add 4 random bot teams to your tournament.

Contributors

Thanks to fluescher for creating this skeleton.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%