Giter Site home page Giter Site logo

pokerwars / pokerwars.io-starterbot-java Goto Github PK

View Code? Open in Web Editor NEW
27.0 5.0 6.0 230 KB

A starter bot written in Java for the pokerwars.io platform. To play: pull this code, register on pokerwars.io, get your API token and play!

Home Page: https://www.pokerwars.io/

Java 100.00%
artificial-intelligence bot poker games machine-learning machine-intelligence poker-game poker-engine artificial-intelligence-algorithms artificialintelligence

pokerwars.io-starterbot-java's Introduction

pokerwars.io-starterbot-java

This is a simple example of how you could implement a pokerwars.io bot with Java and Spring Boot. It comes with a few simple poker strategies, the default is RANDOM, but you should change this and try to implement your own!

Quick start

A few requirements to play:

  • have Java 8 JDK or newer installed
  • make sure that the computer where your bot runs is visible from the internet, so we can communicate with him/her. This is an useful service to double check this. Bot default port is 3000, but you can change this on the src/main/resources/application.yml file. If you need help to open a port on your router check this guide, or if you do not have access to your router or your bot is behind a firewall, try ngrok. If you struggle, contact us, we are always willing to help you.
  • Register with us and retrieve your API token and username.
  • check out this repo with git or download it from this link.
  • in the code you just downloaded, update the src/main/resources/application.yml file with your username, token and bot ip address and port:
pokerwars:
    bot:
        username: [[[INSERT-YOUR-POKERWARS-USERNAME-HERE]]]
        token: [[[INSERT-YOUR-POKERWARS-TOKEN-HERE]]]
        # make sure your bot can be seen from external at the IP and port you specify below, so pokerwars.io can talk to him/her.
        # this is an useful service to double check this: http://canyouseeme.org/ . Bot default port is `3000`, but you can change this just above in this file
        endpoint: http://[[[INSERT-YOUR-PUBLICLY-AVAILABLE-BOT-IP-ADDRESS-AND-PORT-HERE]]] # example: http://1.2.3.4:3000/ 

Now you can implement your own poker strategy and play with it! Or use one of the available strategy.

Play!

Now you are ready to run the bot!

If you are in Linux or Mac, open a console and from the main project directory type:

[pokerwars.io-starterbot-java]$ ./gradlew bootRun

If you are on Windows, open a command prompt and from the main project directory type:

pokerwars.io-starterbot-java> gradlew bootRun

The bot will try to subscribe to pokerwars.io when it starts up. If no errors happens, it will start playing straightaway, otherwise you should see an error. The most common is that we cannot see your bot, please double check your bot is visible from the internet and you have configured your router correctly. If you do not have access to your router or your bot is behind a firewall, try ngrok.

Playing on Glitch.com?

It's easy:

  • Import this repo into a new Glitch project
  • Check the Live App URL for your project under Share (it will look like https://<MY_POKERWARS_BOT>.glitch.me)
  • Update your application.yml file as described above
  • Start remixing!

Have fun!

Extending this bot

If something is not clear in this code, refer to also to our documentation for the structure and content of the data we send to your bot. How you choose to manipulate that information to inform your bot's strategy is up to you!

pokerwars.io-starterbot-java's People

Contributors

dimapen avatar francescopeloi avatar giulioleso avatar kortov avatar plopcas avatar pokerwars avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pokerwars.io-starterbot-java's Issues

Probable bug in card strength check logic with ">" not "=" signs

Hi guys, maybe I don't understand something but those conditions seem strange to me. Why there are ">" not "=" signs? As I can see, when there is a POKER, if i check in THREE_OF_A_KIND match method, it will return true? I see that now it doesn't affect the code because strengths match from highest to lowest but anyway it may be a bug

PAIR {
@Override
protected boolean match(final Set<Card> cards) {
return getMaxSameRankCount(cards) > 1;
}

THREE_OF_A_KIND {
@Override
protected boolean match(final Set<Card> cards) {
return getMaxSameRankCount(cards) > 2;
}

POKER {
@Override
protected boolean match(final Set<Card> cards) {
return getMaxSameRankCount(cards) > 3;
}

Change endpoint validation method

Hi there,
I stumbled upon the pokerwars api and wanted to create a sample bot. Unfortunately I get a 400 Bad request when I try to subscribe: "user cwkbot has access but his/her bot endpoint is not valid because we could not ping it. Is your bot visible to the internet?"

For me it is very handy to host my applications in Azure and that what I did with my bot. However Azure doesn't allow pings so that is why my bot is not validated. Wouldn't it be useful to change the validation process and send a http request to the Ping endpoint that the bot needs to implement? I really wouldn't want to configure port forwarding on my home router.

Regards
Dan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.