Skip to content

Instantly share code, notes, and snippets.

@mallman
Created May 10, 2012 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mallman/2650457 to your computer and use it in GitHub Desktop.
Save mallman/2650457 to your computer and use it in GitHub Desktop.
LA Coding Dojo March 28, 2012

LA Coding Dojo, May 9, 2012

-- Blackjack Reloaded!

We're carrying last time's challenge over to tonight. To review, your task is to build a blackjack player with a winning strategy against a casino dealer. Your player interacts with the dealer through a RESTful Web interface hosted at http://dojo.v.wc1.atti.com/. Here is the API:

Show the "leaderboard".

GET /players

Create a player with the given nickname.

POST /players?nick=<nick>

Get the player with the given nick.

GET /players/:nick

Show the blackjack tables.

GET /tables

Sit at a table (opposite a dealer) who draws from a stack of n decks of cards shuffled together. If you don't provide the "decks" parameter it defaults to 1.

POST /tables?nick=<nick>[&decks=<n>]

Get the table with the given table id.

GET /tables/:tableId

Draw a card.

PUT /tables/:tableId/hit

End your turn.

PUT /tables/:tableId/hold

Start a game with the given bet.

PUT /tables/:tableId/startGame?bet=<bet>

We're playing with simplified rules: no double-down, no split, no insurance. The dealer holds on 17. To review the rules, peruse the Wikipedia article. Please post the URL to your solutions in the comments below. Good luck!

@kaykay
Copy link

kaykay commented May 10, 2012

Nate, KK, Benson 's solution, does card counting, winning consistently :

https://github.com/kaykay/ladojo7-blackjack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment