Overview
We are looking to develop a Blackjack game as a Discord bot. The bot will allow users to play Blackjack by interacting with it through various commands. Users will be required to transfer tokens from their wallet to the game’s wallet as a deposit to participate. The bot will manage the game logic, including dealing cards, calculating winnings, and transferring tokens back to the winner’s wallet. Below are the detailed requirements for this project.
Game Initialization
Discord Commmand
Create a command to initiate a new Blackjack game. Users should be able to start a new game by typing a command, e.g., /blackjack new <bet_amount> <token>
.
Users will wait for others to join the blackjack game.
Deposit Requirement
Before joining a game, users must transfer a specified amount of tokens to the game’s wallet as a deposit. The required deposit amount has already been configured and clearly communicated to users when they initiate a game.
Gameplay
Card Dealing
The bot will automatically deal cards to the player and the dealer as each user has 2 cards. Ensure that the deck is shuffled before each game.
The bot will notify users in DM about their card values.
Player Actions
The bot will notify users in DM about their card values with 2 action button “hit" (receive an additional card) or “stand” (end their turn). Each user can do it only once. If users choose “hit”, the additional card will be randomly taken from the remaining cards.
Maximum users to join: 15 users
Winning Calculation
List all the sum card values of each user in the channel. Determine the winner(s) based on the final hands of the players and the dealer. Calculate winnings according to the standard Blackjack rules and payout rates.
- If a player’s hand exceeds 21 points, they lose their bet.
- The player with a hand value closer to 21 than the dealer’s hand wins and higher than 17.
- Otherwise, they lose.
Token Transfers
Winner Payout
Once a winner is determined, transfer the winnings (tokens) from the game’s wallet to the winner’s wallet, double the amount they bet. Ensure that the transfer is secure and transparent.
- If the amount has to pay to the winner > amount that all users deposited ⇒ deduct from the wallet of the user that started the blackjack.
- If the amount have to pay to winner < amount that all users deposited ⇒ the remaining token will be added to the user that started the blackjack
Refund on Tie or Dealer Win
In case of a tie, refund the players’ deposits.
User Interface
Start games & Users join
Command for a new game
/blackjack new <bet_amount> <token>
Discord Response
🃏 BLACKJACK TIME 🃏 ♣️♦️♥️♠️ A new Blackjack game has started! ID. A8ZH9UF Dealer. @Light | Console Labs Bet Amount. 0.01 ICY Player. @username1, @username2, @username3 To join the game, click "Join"
The dealer starts the game
🃏 START THE BLACKJACK ROUND 🃏 When you're ready, just hit the "Start" button. Otherwise, we'll wait until there are 15 players ready to join. Let's get this game started! 🎲👍