A card game from my childhood. The goal is to collect two cards of the same number, and three cards of the same number. Find them? You won! But be fast, because the computer knows how to do it too 👀. Check it out 👉🏽 here
- HTML
- CSS
- JavaScript
- Axios.js
I first started with setting up the API call and setting up the cards to be displayed on the page. Then, I moved on to getting down to the logic of the game. The player's functionality was worked out, mapping out the buttons and setting the correct calculations in place. After, it was time for the computer to become a worthy competitor! The logic for the computer to either take the card from the discard pile, or pick up a card from the draw pile was put in place. And then? Well, then we had a game, people! 🙌🏽💯
When I say that this game did not want to cooperate? Boy, am I understating it 😅 First it was problems with the event listeners for the user's buttons, where I was setting them up, but trying to remove them before the computer's turn started. That.. did not work, of course. At first I was using
I would like to add these extra features to my app in the future:
- A modal with instructions on how to play the game at first launch
- Having a button that will let the user reshuffle the discard pile, if the pickup pile runs out before the game is over
- Dropping confetti when the user wins
- Making it playable as a two-player game
- Adding animations for the card flip/draw/discard
- Make it responsive and playable on mobile