Skip to content

No Limit Code 'Em is variation of the poker game No Limit Hold 'Em. This project was designed as a hackathon in which students build a poker bot that compete against each other at our virtual poker tables. Tournament included a single deck, 3 card replacement, shuffling players and tables, and lots of poker logic.

Notifications You must be signed in to change notification settings

ssapra/No-Limit-Code-Em

Repository files navigation

Enova No-Limit-Code-Em

To set up your environment locally, make sure to run rake db:seed to set up the game statuses.

Suit Lookup

‘c’ = Club

‘d’ = Diamond

‘h’ = Heart

‘s’ = Spade

Face Values

‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’ = Same as face value.

‘T’ = 10

‘J’ = Jack

‘Q’ = Queen

‘K’ = King

‘A’ = Ace

Poker Hand Ranking

Royal Flush

A straight from a ten to an ace with all five cards of the same suit. In poker all suits are ranked equally.

Ah, Kh, Qh, Jh, Th

Straight Flush

Any straight with all five cards of the same suit.

9c, 8c, 7c, 6c, 5c

Four of a Kind

Any four cards of the same rank. If two players share the same Four of a Kind, the bigger fifth card (known as the kicker) decides who wins the pot.

Ah, As, Ad, Ac, Kh

Full House

Any three cards of the same rank together with any two cards of the same rank. Our example shows “Aces full of Kings” and it is a bigger full house than “Kings full of Aces.”

Ah, Ac, Ad, Kh, Kc

Flush

Any five cards of the same suit (not consecutive). The highest card of the five determines the rank of the flush. Our example shows an Ace-high flush, which is the highest possible.

As, Ts, 7s, 6s, 2s

Straight

Any five consecutive cards of different suits. Aces can count as either a high or a low card. Our example shows a five-high straight, which is the lowest possible straight.

5c, 4d, 3s, 2h, Ah

Three of a Kind

Any three cards of the same rank. Our example shows three-of-a-kind Aces, with a King and a Queen as side cards - the best possible three of a kind.

Ah, As, Ad, Ks, Qc

Two Pair

Any two cards of the same rank together with another two cards of the same rank. Our example shows the best possible two-pair, Aces and Kings. The highest pair of the two determines the rank of the two-pair.

Ah, As, Kc, Kh, Qs

One Pair

Any two cards of the same rank. Our example shows the best possible one-pair hand.

Ah, As, Kh, Qs, Jd

High Card

Any hand not in the above-mentioned hands. Our example shows the best possible high-card hand.

Ah, Ks, Qd, Jc, 9s

How to Play Five Card Draw

  1. Players ante up (place a small bet in the pot).

  2. Starting with the player to the dealer’s left, the dealer deals each player five cards, face down.

  3. Everyone picks up their cards from the table and checks out what they have got.

  4. There is a round of betting, starting with the player to the dealer’s left.

  5. When the betting is done, those who are still in the hand get to trade in one, two, or three cards from their hand for new ones.

    • Note: You do not have to trade any cards - if you have already got good hand, you will want to “stand pat” and keep the cards you were first dealt.

  6. After everyone receives their new cards, there is another round of betting, starting to the dealer’s left.

  7. After the betting is completed, players show their hands and the best hand wins the pot.

No Limit Code ‘Em Tournament Rules

  1. Only 1 student can register per team. Teams must have 2 people.

  2. Once registration is declared to be open, you must register at enovapoker.herokuapp.com/registration with your name and game_id.

    1. The name can be any creative username or actual name.
    2. Your game_id MUST be an actual id number that you have on your person. This game_id will prove that the winner is you should you place in the top 3.
    3. Your player key is returned to you upon being registered. This player key must be saved and kept hidden from other teams.
  3. In order to properly send your requests, you must include the player key in your requests. We will give everyone about 15 minutes to make sure they can start making get requests before the tournament is started.

  4. You have 5 seconds to respond back to the server with your action once the server has declared it is your turn. If you do not respond, the server will set your action as a fold and you will wait until the next round to begin play.

  5. You must make the correct move otherwise you will be forced to fold your hand.

    1. Ex. If you bet 200 when you only have 150 chips, you will fold.
    2. Ex. If you call when the minimum bet and your bet are the same, that is the wrong response because a check is expected.
    3. Exception: If you bet 200 when you have 300 chips but the smallest stack is 150, you will be cut down to bet 150 and allowed to stay in the game.

Requests

There will be 2 requests that you need to make to the server.

GET /game_state (Receiving Game State)

Syntax

Request
json
{
  "name" : "Joe",
  "game_id" : 43123123,
  "player_key" : 031siodfj23290u32
}
Response
json
{
  "current_player" : "Sally",
  "replacement" : false,
  "hand" : ["Ac", "3d", "8c", "Ts", "Ah"],
  "bet" : 40,
  "stack" : 400,
  "pot" : 140,
  "min_bet" : 50,
  "max_bet" : 360,
  "max_raise" : 160,
  "betting_summary" : [
    "Sally bets 50",
    "John calls 50"
  ],   
  "replacement_summary" : [
    "Sally replaces 3 cards",
    "John replaces 2 cards"
  ],
  "round_summary" : [
    "Sally won 300 chips with ["2c", "2d", "2h", "3h", "3c"] for Hand#14",
    "John won 200 chips with ["5c", "3d", "8h", "9d", "Ac"] for Hand#16
  ],
  "play" : true,
  "waiting" :false,
  "game_over" : false
  "winning_summary" : [
    "1. Sally",
    "2. John",
    "3. Joe"
  ],
  "message" : "Game is about to Start"
}

Further Explanation on Response

"play" : true signals that it is your turn;
"replacement" : true signals that you should be making a post request to replace your cards
"bet" and "min_bet" : if these two are different, your actions are limited to call, raise, or fold
                      if these two are the same value, your actions are limited to check, bet, or fold
"game_over" : true signals that the tournament is over and that the final summary is available
"waiting" : true signals that your table is waiting for all other tables to be ready to reshuffle the seats

POST /player (Making a move)

Syntax

Request
json
{
  "name" : "John",
  "game_id" : 1203098123,
  "player_key" : "108jj0329fj30982ds",
  "player_action" : "bet",
  "parameters" : "45"
}

Note: When you are determining which cards to replace, set parameters to be “123” to replace your first, second, and third card.

Response

No response given.

Development and Testing

Sandbox

In order to make sure that you are sending the correct information and receivng the correct information, there are several requests you can make.

GET /sandbox/current_turn (Getting game state)

Syntax

Request
json
{
  "name" : "Joe",
  "game_id" : 43123123,
  "player_key" : 031siodfj23290u32
}
Response
json
 {
   "current_player" : "Joe",
   "replacement" : false,
   "hand" : ["5c", "8d", "3d", "As", "Kh"], 
   "bet" : 100,
   "stack" : 400,
   "pot" : 140,
   "min_bet" : 50,
   "max_bet" : 360,
   "max_raise" : 160,
   "betting_summary" : [
     "Sally bets 50",
     "John calls 50"
   ],   
   "replacement_summary" : [
     "Sally replaces 3 cards",
     "John replaces 2 cards"
   ],
   "round_summary" : [
     "John won 200 chips with ["5c", "3d", "8h", "9d", "Ac"] for Hand#16
   ],
   "play" : true,
   "waiting" :false,
   "game_over" : false,
   "message" : "Game is about to Start"
 }

POST /sandbox/player_action (Posting action)

Syntax

Request
json
{
  "name" : "Joe",
  "game_id" : 43123123,
  "player_key" : 031siodfj23290u32,
  "player_action" : "replce",
  "parameters" : "125"
}
Response
json
{
  [
    "---Received---",
    "Name: Joe",
    "ID: 43123123",
    "Player key: 031siodfj23290u32",
    "Action: replce",
    "Parameters: 125",
    " ",
    "Invalid Action: replce"
  ]
}

Prizes

There will be 3 winners - First, Second, and Third place.

About

No Limit Code 'Em is variation of the poker game No Limit Hold 'Em. This project was designed as a hackathon in which students build a poker bot that compete against each other at our virtual poker tables. Tournament included a single deck, 3 card replacement, shuffling players and tables, and lots of poker logic.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published