Code Monkey home page Code Monkey logo

blackjack's Introduction

README

Summary

This is a simple API where you can play blackjack

Demonstration

You can overview functions with following host https://blackjack-ix.herokuapp.com/

Create a game API

Summary

API to create a new game

Endpoint

POST /v1/games

Request params

Following params are required and should be passed in as JSON format.

param required type description sample value
games required {} Should contain player_count and deck_count
player_count required Integer Specify number of players 3
deck_count required Integer Specify number of deck to be used in game 2

Sample request json

{
  "games": {
    "player_count": 3,
    "deck_count": 2
  }
}

Response

Response is given in JSON format and has parameters as follows

param type description sample value
id Integer id of the new game 1
status String Status of the game. "active" or "inactive" active
players [] Include status of each players
dealer {} Status of dealer

and each player/dealer has following paramters

param type description sample value
name String Name of player Player11
status String Status of the player. Available statuses are: "playing", "win", "lose", "push" and "confirmed". playing
score Integer or String Score of player's hand. If score is hidden, "-" will be given 20
hand [String] Cards in hand ["8-club","3-club"]

Deal API

Summary

API to deal the game

Endpoint

POST /v1/games/:id/deal

Request params

Following params are required and should be passed in as JSON format.

param required type description sample value
game required {} Should contain player_count and deck_count
player_id required Integer Specify player id 3
command required String Specify command you want to take. Only available "hit" or "stand" for now hit

Sample request json

{
  "game": {
    "player_id": 1,
    "command": "hit"
  }
}

Response

Response is given in JSON format and has parameters as follows

param type description sample value
id Integer id of the new game 1
status String Status of the game. "active" or "inactive" active
player {} Status of specified player
dealer {} Status of dealer

Show a game API

Summary

API to show detail of given game_id

Endpoint

GET /v1/games/:id

Request params

Following params are required.

param required type description sample value
id required Integer game id 1

Response

Response is given in JSON format and has parameters as follows

param type description sample value
id Integer id of the new game 1
status String Status of the game. "active" or "inactive" active
players [] Include status of each players
dealer {} Status of dealer

Show winners of a game API

Summary

API to show winners of given game_id

Endpoint

GET /v1/games/:id/winner

Request params

Following params are required.

param required type description sample value
id required Integer game id 1

Response

Response is given in JSON format and has parameters as follows

param type description sample value
id Integer id of the new game 1
status String Status of the game. "active" or "inactive" active
winner [] Names of winners

Finish game API

Summary

API to deactivate game for the given game_id

Endpoint

PUT /v1/games/:id/finish

Request params

Following params are required.

param required type description sample value
id required Integer game id 1

Response

Response is given in JSON format and has parameters as follows

param type description sample value
id Integer id of the new game 1
status String Status of the game. "active" or "inactive" active
players [] Include status of each players
dealer {} Status of dealer

Note

blackjack's People

Contributors

satot avatar

Watchers

 avatar James Cloos avatar

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.