Getting started

and code samples

Getting started with the JavaScript client

We have prepared a client that makes it really easy and quick to get started.

Start off by cloning the repo:

git clone https://github.com/cygni/texas-holdem-client-javascript

The poker server runs as a docker process. The clients communicates with the server via sockets on port 4711 and there is a web interface on port 80 (and it is mapped to localhost on port 8080).

Start the server via docker-compose:

docker-compose up poker-server

Now you can browse the admin interface on http://localhost:8080.

Next up, getting the client started. Open a new terminal and start the development shell by executing this:

docker-compose run --rm poker-shell

This starts a terminal where the project root folder is mapped as a volume. In this shell you have all the tools needed to run the client. Start off by installing all libs:

yarn install

Then start the client against your local poker-server:

yarn play:local:training JohnnyPuma

The `JohnnyPuma`-part may look a bit odd but it is simply the name of the poker player.

The code for your bot is placed in the folder named `my-bot`.

So, there are three rooms – `training`, `freeplay`, and finally the `tournament` room. The `training` room is where you typically play when you develop your bot. The `tournament` is the where you meet other bots in a real tournament. In the `freeplay` room you can practice against other bots in a tournament-like style.

There are two servers configured for the client. The local version that is mentioned above and the online version that is hosted on [http://poker.cygni.se](http://poker.cygni.se).

The following start commands are available:

yarn play:local:training
yarn play:local:freeplay
yarn play:local:tournament
yarn play:online:training
yarn play:online:freeplay
yarn play:online:tournament

Note that the player name must be provided as an argument after the `yarn`-command.

To start creating your own bot get hacking on the file index.mjs in the subdirectory /my-bot!

Read more at: https://github.com/cygni/texas-holdem-client-javascript

Prerequisites

You only need three things to get started!

Docker
git

Note that to install Docker for Windows or MacOS you need to create/have an account at dockerhub. It's free and quick to setup.

A good JavaScipt editor is nice to have! Visual Studio Code is great.