Giter VIP home page Giter VIP logo

deck-of-cards's Introduction

Build Status

#:black_joker: Deck of Cards :black_joker: A simple web app that allows users to draw from, shuffle, and reset a deck of playing cards. The app is live here.

##Description

When the server starts, the standard 52 playing cards are added to the deck. Users can then draw cards from the deck until it is empty. Once the deck is empty, users may reset the deck to start over.

The deck is not shuffled by default, but users may shuffle it at any time. Users can also check how many cards are left in the deck. Although the deck contains the regular 52 cards, users may also add additional cards.

Routes

  • POST /card: Adds a card to the deck
    • curl -i -X POST -d '{ "suit": "S", "rank": "A" }' http://localhost:5000/card --> HTTP/1.0 201 CREATED
  • PUT /card: Draws a card from the deck. If the deck is empty then returns an error
    • curl -X PUT localhost:5000/card --> {"rank": "A", "suit": "S"}
    • curl -X PUT localhost:5000/card -->{"errorMessage": "No cards to draw. Please reset the deck or add cards."}
  • PUT /shuffle: Shuffles the cards in the deck
  • PUT /reset: Puts all the drawn cards back in the deck
  • GET /numCardsLeft: Gets the number of cards left in the deck
    • curl -X GET https://deck-of-cards.herokuapp.com/numCardsLeft --> {"numCardsLeft": 50}

Build Instructions

  1. Download and install Python 3.5
  2. Clone this repository to your machine
  3. Open a terminal and change into the root of the repository
  4. Install virtualenv $ pip install virtualenv
  5. Create a virtual environment $ virtualenv venv
  6. Activate the virtual environment $ source venv/bin/activate
  7. Install dependencies $ pip install -r requirements.txt

Running the server

  • $ python start_server.py

Running the tests

  • $ pytest tests

deck-of-cards's People

Contributors

adrielklein avatar

Watchers

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.