Blackjack built using Django, React, Docker and PostgreSQL.
- Assuming a standard deck (52 cards of 4 suits: ♣ Clubs, ♦ Diamonds, ♥ Hearts, ♠ Spades).
- Press a "Deal" button to deal 5 random cards.
- Pressing the button again should deal 5 unique, random cards. Within the same game, you should never get the same cards again that you got in the past (just like a physical deck).
- Add a card counter which shows how many cards are dealt/left.
- Add an ace counter which shows how many aces are left.
- Add a button to reset the game.
- When all the cards have been dealt, Game Over should be displayed. If no aces are left, Game Over should be displayed.
- If there is an ace in the last draw, display Winner, otherwise display You Lose. Better luck next time!
- Assuming a standard deck (52 cards of 4 suits: ♣ Clubs, ♦ Diamonds, ♥ Hearts, ♠ Spades).
- Press a "Deal" button to deal 5 random cards (mutation).
- Pressing the button again should deal 5 unique, random cards. Within the same game, you should never get the same cards again that you got in the past (just like a physical deck).
- API for a card counter which shows how many cards are dealt/left.
- API to reset the game.
- API to show the game is over.
- API for win/lose. If there is an ace in the last draw, display You Win, otherwise display You Lose, Sucker.
- Streak of wins/loses/games played
- Storing user details, login/out
- Rig the game (e.g. player always wins)
- Custom deck support (e.g. other deck images, other lengths of decks, not just 52 cards)
To install frontend, go to frontend folder:
cd ./frontend
yarn install
Then:
yarn start
Then install Python dependencies:
cd backend/
pyenv install 3.9.5
poetry env use ~/.pyenv/versions/3.9.5/bin/python
poetry install
Copy example env vars to .env
. You might need to change DATABASE_URL
based on your environment.
cp .env.example .env
Create the deckofcards
database:
createdb deckofcards
Load the sample user data:
poetry run ./manage.py migrate
poetry run ./manage.py loaddata deckofcards/fixtures/users.json
poetry run ./manage.py runserver 5000