I just finished my first hackathon! It was probably the most fun I had in my coding career so far. The project that our team created was a game of Blackjack. Throughout the project, we had to think of creative ways to get the game working. The following was was my favorite thing from the project.
Card calculations are an important part of Blackjack. How else are you gonna know who won without it.
We did the calculations in the Stand Button. When the player clicks stand, the app will alert them to final scores. After that, the app will tell the user if they are the winner or not.
And playerCardsTotal() is how we calculate the players total. We first start with 3 variables. There are 2 arrays to store cards and 1 for final score. We first map through the prop of the player’s 2 starting cards and the prop of hit cards they may have picked up during the game. We put the hit cards map in an if statement because there is a chance that the prop is empty because the player didn’t need to hit. Once we get all the cards in the first array, we push the numerical value of each card into the second array. 1–10 was easy as we already had the number, so we parseInt() that number. However we cannot use parseInt() with face cards. Instead, we had to push the value of what that card should be. Kings, Queens, and Jacks are scored as 10s, and Aces as 11. Ace in the current build is not dynamic, so in the future the Ace can also be scored as 1. After we get the correct value, we add it all together in the final score variable, then return that value.
I learned a lot from the hackathon! The biggest thing I learned is how to work in groups. Working on the project with others gave me insight on how I might be working with other people on the same project in the future.
Overall, I like what we were able to do in 2 weeks. It was a super enjoyable experience and I would love to do another one in the future. With our app, there are still a lot of improvements that my group and I want to change before making the app playable to everyone. So be on the lookout for when we deploy it out in the future!
Finally, Thank you again to my group members Sean: https://github.com/Sransonette and Grace: https://github.com/gracenak. The project would not be as great without your help and contributions. Here is the link to a demo of the project at the end of the hackathon: www.youtube.com/watch?v=p8oQBL3JXfU just keep in mind that the app is still a work in progress. And if you want to see more of my projects, you can see my GitHub here: https://github.com/JakeKViti