• Stars
    star
    192
  • Rank 202,019 (Top 4 %)
  • Language
    JavaScript
  • Created almost 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Texas Hold'em as played by bots written in JS

JS Poker

JS Poker

A No-limit Texas Hold'em poker tournament for Javascript bots played via pull requests with Travis CI as the dealer.

Bounty challenge complete

Current Winning Players

  1. status3Bot $152306
  2. ThoseAreMyFish $105849
  3. edi9999 $67519
  4. SneakyCharlie $17395
  5. FlopASetBot $3520
  6. whistle_tips $2081
  7. blaBot $1330

Introduction

JsPoker is an automated poker competition, where your opponents are bots written in Javascript. At the moment they are each quite unintelligent/unimaginative. The challenge is to write a competitor in JS that can handily beat them all over the course of 50 tournaments, each with a maximum of 500 hands.

You win if your bot beats the challenged return on it's money, and we consider a bounty claimed when your bot is submitted via a pull request and the Travis-CI tests pass. (Tests will run the tournament simulation and pass or fail based on performance)

Example:

Each bot starts with $1000 for every tournament, regardless of past performance. It must play 50 tournaments against the other bots. Therefore the bot is putting up $50k in total in the tournaments and needs to see a return of $100k if the challenge is 2x. This may seem hard, but keep in mind that over the course of 50 tournaments, the other bots are putting $300k into the pot, you only need to take 1/3 of this.

If you win, your bot will be added to the table to play future bots.

Why

Like many people, I like to play poker and lose money. The obvious next step was to automate this.

How to play

  1. Clone this repo and run 'npm install'
  2. Modify the existing challenger bot
  3. Tune it to double your money over the course of 25,000 hands (50 Tournaments of 500 hands each)
  4. Test it with npm test until your confident it has a good chance of winning.
  5. Submit a pull request. If the Travis tests pass, you win the bounty.
  6. First pull request that passes wins the current round.
  7. Winning bot is added to the table. Contest repeats.

Rules

  1. The game is No-limit Texas Hold'em ($10-20), with each player starting with $1000
  2. Only one file may be modified in the pull request, 'players/challengerBot.js' (Pull requests to fix other issues are gladly accepted however)
  3. You cannot load any modules. This includes Node.js core modules (fs, http, etc.)
  4. Source code may not be obsfuscated/minified. Everyone should be able to learn from your winning bot.
  5. Bots must win through legitimate poker play. Hacking is fine, but the bounty will only be paid to legitimate winners. Think of it this way, if your bot was in a casino, would it get kicked out or arrested?
  6. Only 2 attempts per user, per 24 hour period. You can't just keep updating the pull request and having Travis repeatedly rerun the tests to try and win by luck. I'll consider this is a soft limit, but in general, don't be an ass. TravisCI is a fantastic tool and I don't want to abuse their time or resources.

Installation

# Requires NodeJs >= 0.10.0
git clone https://github.com/mdp/JsPoker.git
cd JsPoker
npm install
npm test
# Now go and turn your bot into a champion!

Building a better poker bot

You can test out your bot with a small 100 hand game using play.js

node play.js

The output will include each bots betting actions and cards held in order to make tuning and debugging easier.

Game data and bot actions

Bots are handed a game data object with the current state of the game and simply have to return a wager as an integer.

Game data

Here's an example game date payload: GameData.json

Game object consists of 6 properties:

  • self Your bots current standing/cards
  • hand The current number hand being played
  • state The betting state of the game. Ex. 'river'
  • betting Betting options available - These are incremental wager options
  • players Array of each player, their actions for any round, and wager/stack
  • community Community cards

Bot Actions

In Texas Hold'em, you're only real options are to stay in the game, or fold. With that in mind bots only need to return an integer representing the additional amount they wish to add to the pot.

The game objects betting property shows the betting options available to the player/bot. call represents the additional amount needed to stay in the game, while raise represents the minimum amount a player can bet if they wish to raise.

  • Wagers of less than the amount required to call are considered a 'fold'
  • Wagers of '0', when the call amount is '0', are considered a check.
  • Wagers greater than the call, but less than the minimum raise will result in a call
  • A negative wager will force a fold.
  • Failure to return an integer will assume a wager of '0', which may in turn result in a fold

Example players

Here's an extremely simple bot that only raises each betting round:

// I only raise!
module.exports = function () {
  var info = {
    name: "RaiseBot"
  };
  function play(game) {
    if (game.state !== "complete") {
      return game.betting.raise;
    }
  }

  return { play: play, info: info }
}

Take a look at the code for the current set of players. Here are a couple decent examples:

Goals

MachinePoker (The library behind JsPoker) will eventually be a platform that allows people to play their bots against each other in real time for real money (In jurisdictions that allow it)

  • Anyone with a small amount of programming experience should be able to play.
  • It should be easy to run a tournament for a group of competitors safely (Skilled play vs Clever hacks)
  • Competitors should be able to lose (or win) real money.
  • Hardware constraints (ex. Bots are each hosted on their own Raspberry Pi)

Contribute

  • Found a bug? By all means feel free to report it or send me a pull request.
  • The next step is to build a tournament system for handling a real-time tournament with separate players, each on their own host.
  • It would be great to give people a way to watch or monitor game play.

Resources

Requirements

  • Node.js >= 0.10
  • an 80386sx microprocessor or better with at least 8 MB of RAM
  • OSx, Ubuntu, BSD, or some other POSIX compatible file system. (I don't have a windows machine to test with. Happy to take PR's to fix this)

More Repositories

1

rotp

Ruby One Time Password library
Ruby
1,525
star
2

gibberish-aes

A fully OpenSSL compliant javascript library for AES encryption.
JavaScript
471
star
3

qrterminal

QR Codes in your terminal
Go
446
star
4

gibberish

Simple Ruby encryption module
Ruby
375
star
5

PlaneBoard

Read your tweets on the go via DNS TXT records
Go
82
star
6

MachinePoker

Gambling.js
CoffeeScript
74
star
7

middlefiddle

Fiddle in the middle with HTTP/HTTPS traffic using Node.js
JavaScript
58
star
8

divining_rod

A mobile phone web request profiler
Ruby
48
star
9

AtlantaWaterMeter

Read the Neptune R900 (Atlanta's) smart water meters with a raspberry pi and an RTL-SDR
Shell
41
star
10

bluemonday-js

The bluemonday sanitizer compiled to JavaScript
JavaScript
38
star
11

GistEvernoteImport

Import your gists to Evernote for searching
Ruby
32
star
12

GSMTracker

Use an unactivated prepaid Android phone to track it's own location.
Java
30
star
13

honeypot.go

SSH Honeypot written in Go
Go
27
star
14

u2fdemo

U2F Demo and Debugger
JavaScript
26
star
15

morse.mdp.im

Morse code app and podcast focused on head copy
TypeScript
26
star
16

hoyle

A javascript poker hand evaluator
CoffeeScript
24
star
17

iMessageChatDecompile

A decompilation of iMessage Chat from Huluwa
23
star
18

SlidePrint

Print and Capture any DocSend deck or document
TypeScript
21
star
19

runnel

A really simple Ruby ssh tunnel manager
Ruby
21
star
20

monochromeoled

Golang Library for working with SSD1306 OLEDs
Go
18
star
21

binions

A javascript Texas Holdem tournament engine
CoffeeScript
17
star
22

gibberish-libsodium

An example of using Libsodium in the browser for simple secret key based encryption
JavaScript
16
star
23

gloss

Super simple HTTPS reverse proxy written in Go
Go
14
star
24

u2fcli

Command line tool for using U2F tokens
Go
13
star
25

cist

Curl to Gist
JavaScript
12
star
26

dotp

Decentralized One Time Passwords
JavaScript
12
star
27

sodiumbox

Libsodium's crypto_box_sealed in pure golang
Go
10
star
28

hoganjs-brunch

A brunch compiler for Mustache template, using Hogan.js
JavaScript
9
star
29

node-at-yahoo

Shameless ploy to recruit via npm
JavaScript
8
star
30

plentyofstats

Ruby
7
star
31

gotraceroute

A very half-ass version of traceroute in Go
Go
6
star
32

pitboss

Run dubious code in node!
CoffeeScript
6
star
33

smallfont

Small monospaced pixel font (8x8) and rasterizer for LED/LCD projects
Go
6
star
34

Economist-Kindle

No longer actively maintained. Use Michael Kaiser's project below
Ruby
6
star
35

dns_leak_client

Leak information via DNS queries. Perfect for communicating with servers from behind a firewall/pay portal/restricted network
Java
6
star
36

quickadmin

A merb slice to quickly add admin only access via OpenID
Ruby
4
star
37

gibberish-aes-ruby

A fork of Alex Boussinet's Ruby AES library modified to support OpenSSL AES
Ruby
4
star
38

delo

Utility for writing to an OLED on Raspberry Pi
Go
4
star
39

sjcl_rb

The SJCL project in Ruby for compatibility
Ruby
4
star
40

NCoinbase

NodeJS library to interface with Coinbase via OAuth 2.0
JavaScript
3
star
41

docker-pdf-tools

My hacky but useful PDF tools
Shell
3
star
42

dnstime

Get the current time from a dns query
Go
3
star
43

json-zips

Zip codes in JSON and mirrored on Google Code for easy querying.
Ruby
3
star
44

ESP32_DNS_Tracker

Rust
3
star
45

BaseCJK

BaseCJK encoding in Javascript
JavaScript
3
star
46

openobserve_github_action_logs

Send Github Action logs to an OpenObserve instance
TypeScript
2
star
47

dns_leak_server

The counter party to dns_leak
JavaScript
2
star
48

will_it_dial

A paranoid phone number validator
Ruby
2
star
49

go-statx

Simple CLI and library for StatX API
Go
2
star
50

simple_admin

A simple Open ID auth plugin for userless apps
Ruby
2
star
51

privacy_policy

My Privacy Policy for apps I make.
2
star
52

CellIdToGeo

Convert GSMTracker logs to Lat Long coordinates and display it on a map
JavaScript
2
star
53

prisma_hyperdx

A quick sample of tracing in Prisma with OpenTelemetry and sending it to HyperDX
TypeScript
2
star
54

optimus_prime

A lazy sunday hack - crack RSA keys in JS
JavaScript
1
star
55

pingtags_dmca

Copyright 2018 Mark Percival - All rights reserved
JavaScript
1
star
56

docker-shallot

Run shallot in docker
1
star
57

ephemeral_twitter

Ephemeral Twitter
Ruby
1
star
58

four_bites_aes

A cipher for encoding 4 byte integers - i.e. Obfuscate your MySQL record id's
Ruby
1
star
59

UiPathTextAndFileEncryptionFlaw

The technical details and information related to a severe flaw in the handling of encryption in a popular UiPath plugin
C#
1
star
60

webpacker-docker

An example application for Rails 5.2 + Webpacker 3.4.3 on Docker/Docker Compose
Ruby
1
star
61

BitcoinArtAttack

JavaScript
1
star
62

twitter_getter

A simple ruby gem for accessing the Twitter API
Ruby
1
star
63

dAuth

The dAuth App
JavaScript
1
star
64

pulley

Send pull requests to github via the command line - Gem now maintained by HQMQ at https://github.com/hqmq/pulley
Ruby
1
star
65

emailparse

Command line email parser - Personal use: bash scripts involving inbound email from SES
Go
1
star
66

rsc

RSC mirror of the QR code from code.google.com
Go
1
star
67

baroku

Demo for Codepath Nodejs Class
JavaScript
1
star
68

dotfiles

My dotfiles
Shell
1
star
69

docker-awscli

AWS and Elastic Beanstalk CLI in Docker
1
star
70

pls

Parse PLS files (Typically MP3 stream playlists)
CoffeeScript
1
star