Inspiration - One of my favorite hobbies is playing cards with my friends and family. A card game that suits me and interests me the most when I play with my friends and family is the game, "Blackjack". Thus, I decided to create the game in repl.it using the language c, for others to enjoy the thrill of the game.
What it does - A player will play against the dealer in the game. The user of this game must beat the dealer by scoring near 21 or a perfect score of 21 called “BlackJack” using the two cards dealt with them. If the sum of their cards goes over 21, they lose and it is called a “bust”.
How I built it - I created the game using a one-dimensional array which is storing int as the type of the value. Furthermore, I performed several calculations in the program loops. For example, I used greater than symbols and calculations to check whether the user’s cards are higher than the dealer’s card. Additionally, I used multiple if statements in my program to determine whether the user won the game or the dealer won the game. To elaborate more, if the user’s cards when added are greater than the dealer’s cards and are lower or equal to 21, then the user wins the game. However, if this is not true, then the dealer has won the game making the user lose the game.
Challenges we ran into - One of the challenges I ran in the game was with the one-dimensional array to store the card sets for the player and dealer. Initially, I had created a character array to store numbers as the characters but I soon faced a challenge as I realized character arrays cannot store the number "10". Thus, to overcome this challenge, I had switched from a character array to an int array to store the different values for the card sets.
Accomplishments that we're proud of - I am proud of creating the game revolving around the user input. This game heavily interacts with the user and allows them to play blackjack with the computer/
What we learned - I learned multiple things when creating this project. I honed my skills in arrays, loops, calculations, etc. Overall, this project was a fun project to create and was a marvelous experience.
What's next for Blackjack - In the future, I hope to improve and work on this game by making multiple enhancements. One of the enhancements I hope to add is the option for the user to play again and start with the money they had last round until they lose all their money.
Log in or sign up for Devpost to join the conversation.