From b68fbbbc886e4f07e387a8e81b227d80f230937a Mon Sep 17 00:00:00 2001 From: nvspranathi <19h71a0453@gmail.com> Date: Thu, 30 Jan 2025 19:44:36 +0530 Subject: [PATCH 1/6] changes made till code structure --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 066e731..32088cf 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ -# Blackjack Application +# Casino Application ## Introduction ### Overview -This project involves the development of a Blackjack game application using Python and the Tkinter library for the graphical user interface (GUI). The game provides an interactive and engaging way to play Blackjack, simulating a real casino environment where the user competes against the dealer. The application includes features such as placing bets, hitting, standing, doubling down, and splitting hands. +This project involves the development of a casino games application using Python and the Tkinter library for the graphical user interface (GUI). The game provides an interactive and engaging way to play Blackjack, Dice Game, and Limbo, simulating a real casino environment where the user competes against the dealer. The application includes features such as placing bets, hitting, standing, doubling down, and splitting hands in Blackjack, rolling dice in the Dice Game, and predicting outcomes in Limbo. ### Objectives -- To create a user-friendly and interactive Blackjack game. + - To implement the core functionalities of Blackjack, including dealing cards, calculating hand values, and managing bets. +- To develop the Dice Game, allowing users to roll dice and win based on the outcome. +- To create the Limbo game, where users predict outcomes and win based on their predictions. - To provide a simple and intuitive GUI for a seamless gaming experience. ## Blackjack Game Overview @@ -25,12 +27,25 @@ Blackjack, also known as 21, is one of the most popular casino card games worldw - **Dealer’s Turn:** The dealer reveals their face-down card and must hit until their hand value is 17 or higher. - **Winning:** The player wins if their hand value is closer to 21 than the dealer’s without exceeding 21. A hand value over 21 is a 'bust,' resulting in an automatic loss. +### How to Play Dice Game + +- **Placing Bets:** Players place their bets on the outcome of the dice roll. +- **Rolling Dice:** The player chooses a target number and chooses whether the dice 'Rolls Over' or 'Rolls Under' and click 'Roll Dice'. +- **Winning:** The player wins if the number obtained post rolling matches their bet prediction. The Bet amount is won by the player if he wins the bet else the player looses that amount. + +### How to Play Limbo + +- **Placing Bets:** Players place their bets and predict a multiplier value. +- **Game Start:** The game generates a random multiplier. +- **Winning:** The player wins if the generated multiplier is higher than their predicted value. The payout is calculated based on the predicted multiplier and the actual multiplier. + ## Application Features - **Graphical User Interface (GUI):** Developed using Tkinter, providing an interactive interface for gameplay. - **Bet Management:** Allows users to place bets and manage their balance. -- **Game Actions:** Implemented core game actions such as hit, stand, double down, and split. -- **Game State Management:** Automatically handles the game state, including shuffling the deck and resetting the game after each round. +- **Game Actions:** Implemented core game actions such as hit, stand, double down, and split for Blackjack; rolling dice for Dice Game; and predicting multipliers for Limbo. +- **Game State Management:** Automatically handles the game state, including shuffling the deck, rolling dice, generating multipliers, and resetting the game after each round. + ## Implementation @@ -38,16 +53,33 @@ Blackjack, also known as 21, is one of the most popular casino card games worldw - **Python:** Main programming language. - **Tkinter:** Used for creating the GUI. -- **Random:** Used for shuffling the deck and dealing cards. +- **Random:** Used for shuffling the deck and dealing cards, rolling dice, and generating random multipliers in the Limbo game. ### Code Structure -The application code is organized into several key sections: +The application code is organized into several key sections for each game: + +#### Blackjack Game + +1. **Imports and Initial Setup:** Import necessary libraries and initialize constants like the deck of cards, balance, and other game-specific variables. +2. **Helper Functions:** Define functions for dealing cards, and calculating hand values. +3. **BlackjackApp Class:** Main class encapsulating all Blackjack game logic, including GUI elements, game actions, and state management. + +#### Dice Game + +1. **Imports and Initial Setup:** Import necessary libraries and initialize constants like the dice, balance, and other game-specific variables. +2. **Helper Functions:** Define functions for rolling dice and playing sound effects. +3. **DiceGame Class:** Class encapsulating all Dice game logic, including GUI elements, game actions, and state management. + +#### Limbo Game + +1. **Imports and Initial Setup:** Import necessary libraries and initialize constants like the multipliers, balance, and other game-specific variables. +2. **Helper Functions:** Define functions for generating multipliers and playing sound effects. +3. **LimboGame Class:** Class encapsulating all Limbo game logic, including GUI elements, game actions, and state management. + +#### Main Execution -1. **Imports and Initial Setup:** Import necessary libraries and initialize constants like the deck of cards and balance. -2. **Helper Functions:** Define functions for dealing cards and calculating hand values. -3. **BlackjackApp Class:** Main class encapsulating all game logic, including GUI elements, game actions, and state management. -4. **Main Execution:** Initialize and run the game application. +1. **Main Execution:** Initialize and run the game application. ### Detailed Code Explanation @@ -61,6 +93,7 @@ The application code is organized into several key sections: - Deal Card: Selects a random card from the deck, removes it from the deck, and returns it. - Calculate Hand Value: Calculates the total value of a hand. If the total value exceeds 21 and there are Aces in the hand, it reduces the total value by 10 for each Ace until the value is 21 or less, or there are no more Aces to adjust. +- Play Sound: Plays a sound effect based on the action (deal, win, lose). **BlackjackApp Class** @@ -79,6 +112,7 @@ The application code is organized into several key sections: - End Round: Ends the round, determining the outcome based on the player's and dealer's hand values, updating the balance, and resetting the bet. - Reset Bet: Resets the bet entry field. - Shuffle Deck: Shuffles the deck when the number of remaining cards is low. +- Update Statistics: Updates and displays player statistics after each round. ## Main Execution From ec83763a9bf97a2295c48d843b6ef9297fdd7904 Mon Sep 17 00:00:00 2001 From: nvspranathi <19h71a0453@gmail.com> Date: Fri, 31 Jan 2025 18:39:18 +0530 Subject: [PATCH 2/6] added limbo and dice game classes description --- README.md | 51 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 32088cf..ae235fa 100644 --- a/README.md +++ b/README.md @@ -68,21 +68,55 @@ The application code is organized into several key sections for each game: #### Dice Game 1. **Imports and Initial Setup:** Import necessary libraries and initialize constants like the dice, balance, and other game-specific variables. -2. **Helper Functions:** Define functions for rolling dice and playing sound effects. +2. **Helper Functions:** Define functions for rolling. 3. **DiceGame Class:** Class encapsulating all Dice game logic, including GUI elements, game actions, and state management. #### Limbo Game 1. **Imports and Initial Setup:** Import necessary libraries and initialize constants like the multipliers, balance, and other game-specific variables. -2. **Helper Functions:** Define functions for generating multipliers and playing sound effects. +2. **Helper Functions:** Define functions for generating multipliers. 3. **LimboGame Class:** Class encapsulating all Limbo game logic, including GUI elements, game actions, and state management. -#### Main Execution +### Detailed Code Explanation -1. **Main Execution:** Initialize and run the game application. +### Dice Game +**Imports and Initial Setup** -### Detailed Code Explanation +- Balance: Starting balance for the player, initially set to 1000. +- Target Number: The target number is set to 50 on a slider. +- Chosen Option: The "Roll under" option is chosen initially. + +**Helper Functions** +- Calculate Win Amount: This function calculates the amount won based on the bet and the probability. + +**Dice Game Class** + +- Initialization: Initializes the Blackjack game window, setting up the initial state and creating the GUI components. +- Create Widgets: Sets up the GUI components, including labels, buttons, and entry fields for displaying game information and allowing user actions. +- Set Bet Options: Sets the chosen betting option and updates the result label with the selected option and target value. +- Roll Dice: Simulates a dice roll, updates the user's balance based on the bet and result, and displays the outcome. +- Update Balance: Updates the balance label to reflect the current balance. +- Go Back to Menu: Closes the current window and reopens the start window. + +### Limbo Game +**Imports and Initial Setup** + +- Balance: Starting balance for the player, initially set to 1000. +- Bet Amount: the initial bet amount will be 10. +- Multiplier Value: Starting Multiplier value is set to 2. + +**Helper Functions** + +- Play Limbo: The play_limbo function handles the betting logic, calculates win probability, determines the game result, updates the balance, and displays the outcome. + +**Limbo Class** + +- Initialization: Initializes the Blackjack game window, setting up the initial state and creating the GUI components. +- Create Widgets: Sets up the GUI components, including labels, buttons, and entry fields for displaying game information and allowing user actions. +- Update Balance: Updates the balance label to reflect the current balance. + +### Blackjack Game **Imports and Initial Setup** - Balance: Starting balance for the player, initially set to 1000. @@ -93,11 +127,11 @@ The application code is organized into several key sections for each game: - Deal Card: Selects a random card from the deck, removes it from the deck, and returns it. - Calculate Hand Value: Calculates the total value of a hand. If the total value exceeds 21 and there are Aces in the hand, it reduces the total value by 10 for each Ace until the value is 21 or less, or there are no more Aces to adjust. -- Play Sound: Plays a sound effect based on the action (deal, win, lose). + **BlackjackApp Class** -- Initialization: Initializes the main application window, setting up the initial state and creating the GUI components. +- Initialization: Initializes the Blackjack game window, setting up the initial state and creating the GUI components. - Create Widgets: Sets up the GUI components, including labels, buttons, and entry fields for displaying game information and allowing user actions. - Update Balance: Updates the balance label to reflect the current balance. - Place Bet: Validates the bet amount and starts a new round if the bet is valid. @@ -112,11 +146,10 @@ The application code is organized into several key sections for each game: - End Round: Ends the round, determining the outcome based on the player's and dealer's hand values, updating the balance, and resetting the bet. - Reset Bet: Resets the bet entry field. - Shuffle Deck: Shuffles the deck when the number of remaining cards is low. -- Update Statistics: Updates and displays player statistics after each round. ## Main Execution -The main part of the application initializes the main application window and starts the Tkinter main loop. +The main part of the application initializes the main application window and starts the Tkinter main loop. ## Conclusion From 150b71c0e13b583b70eba6c92a00112d89aef906 Mon Sep 17 00:00:00 2001 From: nvspranathi <19h71a0453@gmail.com> Date: Fri, 31 Jan 2025 18:46:18 +0530 Subject: [PATCH 3/6] made changes in the order --- README.md | 69 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index ae235fa..5f8181c 100644 --- a/README.md +++ b/README.md @@ -14,18 +14,21 @@ This project involves the development of a casino games application using Python - To create the Limbo game, where users predict outcomes and win based on their predictions. - To provide a simple and intuitive GUI for a seamless gaming experience. -## Blackjack Game Overview +## Casino Games Overview -### What is Blackjack? +### What are Lmbo, Dice game and Blackjack? + +Limbo is a game where players predict a multiplier value, and the game generates a random multiplier. The player wins if the generated multiplier is higher than their predicted value. The payout is calculated based on the predicted multiplier and the actual multiplier. + +Dice Game involves players placing bets on the outcome of a dice roll. Players choose a target number and predict whether the dice will roll over or under that number. The player wins if the outcome matches their prediction, and the bet amount is won or lost accordingly. Blackjack, also known as 21, is one of the most popular casino card games worldwide. The goal is to have a hand value closer to 21 than the dealer’s without exceeding 21. Players are dealt two initial cards and can choose to receive additional cards (hit) or keep their current hand (stand). -### How to Play Blackjack +### How to Play Limbo -- **Initial Deal:** Each player is dealt two cards, and the dealer receives two cards (one face up and one face down). -- **Player’s Turn:** Players can choose to 'hit' (receive another card) or 'stand' (keep their current hand). They can also 'double down' (double their bet and receive one more card) or 'split' (if the two initial cards are of the same value). -- **Dealer’s Turn:** The dealer reveals their face-down card and must hit until their hand value is 17 or higher. -- **Winning:** The player wins if their hand value is closer to 21 than the dealer’s without exceeding 21. A hand value over 21 is a 'bust,' resulting in an automatic loss. +- **Placing Bets:** Players place their bets and predict a multiplier value. +- **Game Start:** The game generates a random multiplier. +- **Winning:** The player wins if the generated multiplier is higher than their predicted value. The payout is calculated based on the predicted multiplier and the actual multiplier. ### How to Play Dice Game @@ -33,11 +36,12 @@ Blackjack, also known as 21, is one of the most popular casino card games worldw - **Rolling Dice:** The player chooses a target number and chooses whether the dice 'Rolls Over' or 'Rolls Under' and click 'Roll Dice'. - **Winning:** The player wins if the number obtained post rolling matches their bet prediction. The Bet amount is won by the player if he wins the bet else the player looses that amount. -### How to Play Limbo +### How to Play Blackjack -- **Placing Bets:** Players place their bets and predict a multiplier value. -- **Game Start:** The game generates a random multiplier. -- **Winning:** The player wins if the generated multiplier is higher than their predicted value. The payout is calculated based on the predicted multiplier and the actual multiplier. +- **Initial Deal:** Each player is dealt two cards, and the dealer receives two cards (one face up and one face down). +- **Player’s Turn:** Players can choose to 'hit' (receive another card) or 'stand' (keep their current hand). They can also 'double down' (double their bet and receive one more card) or 'split' (if the two initial cards are of the same value). +- **Dealer’s Turn:** The dealer reveals their face-down card and must hit until their hand value is 17 or higher. +- **Winning:** The player wins if their hand value is closer to 21 than the dealer’s without exceeding 21. A hand value over 21 is a 'bust,' resulting in an automatic loss. ## Application Features @@ -59,11 +63,11 @@ Blackjack, also known as 21, is one of the most popular casino card games worldw The application code is organized into several key sections for each game: -#### Blackjack Game +#### Limbo Game -1. **Imports and Initial Setup:** Import necessary libraries and initialize constants like the deck of cards, balance, and other game-specific variables. -2. **Helper Functions:** Define functions for dealing cards, and calculating hand values. -3. **BlackjackApp Class:** Main class encapsulating all Blackjack game logic, including GUI elements, game actions, and state management. +1. **Imports and Initial Setup:** Import necessary libraries and initialize constants like the multipliers, balance, and other game-specific variables. +2. **Helper Functions:** Define functions for generating multipliers. +3. **LimboGame Class:** Class encapsulating all Limbo game logic, including GUI elements, game actions, and state management. #### Dice Game @@ -71,50 +75,50 @@ The application code is organized into several key sections for each game: 2. **Helper Functions:** Define functions for rolling. 3. **DiceGame Class:** Class encapsulating all Dice game logic, including GUI elements, game actions, and state management. -#### Limbo Game +#### Blackjack Game -1. **Imports and Initial Setup:** Import necessary libraries and initialize constants like the multipliers, balance, and other game-specific variables. -2. **Helper Functions:** Define functions for generating multipliers. -3. **LimboGame Class:** Class encapsulating all Limbo game logic, including GUI elements, game actions, and state management. +1. **Imports and Initial Setup:** Import necessary libraries and initialize constants like the deck of cards, balance, and other game-specific variables. +2. **Helper Functions:** Define functions for dealing cards, and calculating hand values. +3. **BlackjackApp Class:** Main class encapsulating all Blackjack game logic, including GUI elements, game actions, and state management. ### Detailed Code Explanation -### Dice Game +### Limbo Game **Imports and Initial Setup** - Balance: Starting balance for the player, initially set to 1000. -- Target Number: The target number is set to 50 on a slider. -- Chosen Option: The "Roll under" option is chosen initially. +- Bet Amount: the initial bet amount will be 10. +- Multiplier Value: Starting Multiplier value is set to 2. **Helper Functions** -- Calculate Win Amount: This function calculates the amount won based on the bet and the probability. +- Play Limbo: The play_limbo function handles the betting logic, calculates win probability, determines the game result, updates the balance, and displays the outcome. -**Dice Game Class** +**Limbo Class** - Initialization: Initializes the Blackjack game window, setting up the initial state and creating the GUI components. - Create Widgets: Sets up the GUI components, including labels, buttons, and entry fields for displaying game information and allowing user actions. -- Set Bet Options: Sets the chosen betting option and updates the result label with the selected option and target value. -- Roll Dice: Simulates a dice roll, updates the user's balance based on the bet and result, and displays the outcome. - Update Balance: Updates the balance label to reflect the current balance. -- Go Back to Menu: Closes the current window and reopens the start window. -### Limbo Game +### Dice Game **Imports and Initial Setup** - Balance: Starting balance for the player, initially set to 1000. -- Bet Amount: the initial bet amount will be 10. -- Multiplier Value: Starting Multiplier value is set to 2. +- Target Number: The target number is set to 50 on a slider. +- Chosen Option: The "Roll under" option is chosen initially. **Helper Functions** -- Play Limbo: The play_limbo function handles the betting logic, calculates win probability, determines the game result, updates the balance, and displays the outcome. +- Calculate Win Amount: This function calculates the amount won based on the bet and the probability. -**Limbo Class** +**Dice Game Class** - Initialization: Initializes the Blackjack game window, setting up the initial state and creating the GUI components. - Create Widgets: Sets up the GUI components, including labels, buttons, and entry fields for displaying game information and allowing user actions. +- Set Bet Options: Sets the chosen betting option and updates the result label with the selected option and target value. +- Roll Dice: Simulates a dice roll, updates the user's balance based on the bet and result, and displays the outcome. - Update Balance: Updates the balance label to reflect the current balance. +- Go Back to Menu: Closes the current window and reopens the start window. ### Blackjack Game **Imports and Initial Setup** @@ -128,7 +132,6 @@ The application code is organized into several key sections for each game: - Deal Card: Selects a random card from the deck, removes it from the deck, and returns it. - Calculate Hand Value: Calculates the total value of a hand. If the total value exceeds 21 and there are Aces in the hand, it reduces the total value by 10 for each Ace until the value is 21 or less, or there are no more Aces to adjust. - **BlackjackApp Class** - Initialization: Initializes the Blackjack game window, setting up the initial state and creating the GUI components. From 3ea9a997e1f518397471d468a423c55e0592e598 Mon Sep 17 00:00:00 2001 From: nvspranathi <19h71a0453@gmail.com> Date: Fri, 31 Jan 2025 18:48:46 +0530 Subject: [PATCH 4/6] made changes in the conclusion --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f8181c..3d6ce47 100644 --- a/README.md +++ b/README.md @@ -156,4 +156,4 @@ The main part of the application initializes the main application window and sta ## Conclusion -This Python Blackjack game project successfully demonstrates the integration of game logic with a graphical user interface. The game is designed to provide a realistic and engaging Blackjack experience, with functionalities that mirror a real casino environment. The use of Python and Tkinter allows for a simple yet effective implementation, making the game both fun and educational for users interested in learning about game development and GUI design. +This Python casino games project successfully demonstrates the integration of game logic with a graphical user interface. The game is designed to provide a realistic and engaging casino games experience, with functionalities that mirror a real casino environment. The use of Python and Tkinter allows for a simple yet effective implementation, making the game both fun and educational for users interested in learning about game development and GUI design. From c73ab5eecc8349520389e7e1e2d19a3a179aef85 Mon Sep 17 00:00:00 2001 From: nvspranathi <19h71a0453@gmail.com> Date: Fri, 31 Jan 2025 18:51:38 +0530 Subject: [PATCH 5/6] typing error corrected --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d6ce47..83458e0 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This project involves the development of a casino games application using Python ## Casino Games Overview -### What are Lmbo, Dice game and Blackjack? +### What are Limbo, Dice game and Blackjack? Limbo is a game where players predict a multiplier value, and the game generates a random multiplier. The player wins if the generated multiplier is higher than their predicted value. The payout is calculated based on the predicted multiplier and the actual multiplier. From 3d5321c978e209ae9ddaa69c499989c4177a4151 Mon Sep 17 00:00:00 2001 From: nvspranathi <19h71a0453@gmail.com> Date: Sat, 1 Feb 2025 22:34:43 +0530 Subject: [PATCH 6/6] added overview of rehab services --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83458e0..7b0ecff 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Limbo is a game where players predict a multiplier value, and the game generates Dice Game involves players placing bets on the outcome of a dice roll. Players choose a target number and predict whether the dice will roll over or under that number. The player wins if the outcome matches their prediction, and the bet amount is won or lost accordingly. -Blackjack, also known as 21, is one of the most popular casino card games worldwide. The goal is to have a hand value closer to 21 than the dealer’s without exceeding 21. Players are dealt two initial cards and can choose to receive additional cards (hit) or keep their current hand (stand). +Blackjack, also known as 21, is one of the most popular casino card games worldwide. The goal is to have a hand value closer to 21 than the dealer’s without exceeding 21. Players are dealt two initial cards and can choose to receive additional cards (hit) or keep their current hand (stand). When the user has only half the initial amount, to warn users about losing all their money if they proceed further, an option is provided to stop gambling and shows rehabilitation resources. ### How to Play Limbo