Inspiration
Love for CS and card games.
What it does
Basic version of blackjack(aka 21). You start the game by clicking the deal, the dealer draws 2 cards (1 hidden) & 2 more cards are added to the player deck.(visible). Then you can either choose to hit(draw a new card) or stand(keep your current deck as it is.) The dealer's deck is then shown and the winner is decided based on the standard rules of blackjack.
How I built it
Used ReactJS for the client and all the card operations are carried out using Deck of Cards API link. Designed the basic layout using TailwindCss
Challenges I ran into
The state refresh after updating the card decks was happening early and hence the new card wouldnt be included in the deck, turns out it could be solved using an async function inside the useEffect() react hook.
Tried to pick up TailwindCss along the way, the installation with react was a bit unconventional, eventually figured it out.
Implementing the game winning conditions on JS was a bit difficult.
Accomplishments that I'm proud of
Figured out how to use localStorage properly along with the useEffect hook. Implemented the standard logic for winning the game. Gained a better understanding of async functions in JS. All this within just 5 hours.
What I learned
TailwindCss, LocalStorage API, Deckofcards API, React Hooks, Card Theory.
What's next for Basic BlackJack
I would like to add more features that include deck splitting, double-downs and user aurthentication. Also plan to implement a multiplayer version of this and improve the UI.
Built With
- deckofcards-api
- javascript
- react
- tailiwindcss
Log in or sign up for Devpost to join the conversation.