this a good place to ask for help with web programming? I am in desperate need of assistance. I have a project due where I need to create a Blackjack game with the following functionality:
a) "Splitting" capability: What is splitting? If you hold two cards with the same value, like two eights or two sixes, you can split them into separate hands and play each hand individually. For this project, once the two cards are split, they should be treated as two separate hands, each with its own "hit," "stay," and "split" (if the two cards are the same) buttons. To achieve this, I need to add a button that appears only when the player holds two identical cards, and otherwise stays hidden. Once the button is clicked, the two cards should be split into two hands.
b) "Reset" capability: Currently, the game can only be reset by refreshing the page. I need to create a button that resets the game environment and starts a new game by clearing the scores and cards, without refreshing the page.
c) Disable "hit" button: When the player's total exceeds 21, the "hit" button should be disabled and grayed out to prevent further action, until the game is reset or a new game begins.
I’ve managed to get b) and c) working, but no matter what I try, I haven’t been able to get splitting to work. Additionally, I need to add a backlog feature that tracks matches, pauses, and records the player's progress, so users can return to their previous place in the game.
I’ve tried everything and I'm at my wit's end. I’ve talked to my professor, but he can only help during office hours and doesn’t respond to emails frequently. I’ve asked a friend, but they don’t know much about web programming. I’ve also talked to a cousin, and since my class doesn’t have a TA, I can’t ask them. I’ve searched YouTube and asked ChatGPT for help, but nothing has worked so far, and I’m running out of time. I need to finish this by Wednesday. I’m not sure what else to do.
Top comments (1)
I assume you have a player state that remembers which cards are given by the dealer.
For the splitting functionality you have to extend that state with hands and the logic that is written for the player, hit/stay/split/counting , is mostly going to move to the hand.
For the splitting button, when a card has been added to the hand check if the same card value is in cards the player already has. When that is the case show the button.
I don't know how splitting works but I guess if you click the split button, one of the cards with the same value goes to a new hand.
Creating more specialised components in your application seems to be the goal of this exercise.
Breaking up concepts into smaller pieces makes it easier to change code when the requirements change.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.