Skip to content

ShorenaK/BlackJack-AWS

Repository files navigation

Shorena K. Anzhilov CS5001 Final Project - "BlackJack Game"

Game Descriptiion:

The "BlackJack" card game is tailored for one player competing against the dealer. The game begins with the player clicking the "Start the game" button, prompting the shuffling of two cards for the player. The objective is to beat the dealer by achieving a score as close to 21 as possible or hitting 21 itself.

After the initial card deal, players can draw a new card using the "New Card" button. If the cumulative card value exceeds 21, the player receives a "You lost a Bet!" message. Achieving a card value of 21 results in a victory for the player, with an additional 50 chips added to the total. Player starts with 1000 chips, and winning earns a 50 chips, while losing deducts 50 chips.

Notably, the game uses a unique approach, displaying only numerical representations.

In case of a tie, where both the player and the dealer have the same card value, a "It's a TIE" message is displayed. If the dealer hits Black Jack, the player automatically loses, with 50 chips deducted and the message "'Table Wins Black Jack! is displayed"

A third button " End" is incorporated for navigation to the main page, and to end the game. The main page is serving as the entrance to the casino and the starting point to enter Black Jack Table.

Preview

alt text alt text

Go to app:

CLICK HERE!

Technologies Implemented - Tech Stack:

  • Server-side: Python3, Flask
  • Frontend: HTML, JavaScript (with Ajax for asynchronous requests)
  • CSS
  • Deployed on AWS (Amazon Web Services) - EC2.

Description:

Server-side: The backend of the application is powered by Python3 with the Flask lightwaight web framework, handling the game logic and serving responses to client requests.

Frontend: The user interface is built using HTML for structure, JavaScript for dynamic interactions (including Ajax for asynchronous communication with the Flask server), and CSS for styling.

Resources:

    1. Flask Documentation: Official documentation for Flask, the web framework used in this project.
    1. JQuery Documentation: Documentation for JQuery, a JavaScript library used for making asynchronous requests in this project.
    1. Python Documentation: Official documentation for the Python programming language.
    1. Blackjack Rules: A resource explaining the basic rules of Blackjack for reference.
    1. CSS Tricks: Helpful tips and tricks for working with CSS.
    1. Flask Tutorial: Step-by-step guide for getting started with Flask. A great resource if you're new to Flask development.
  • Google & Stak OverFlow.

  • reddit.

Missing Features:

  • Multiplayer Support
  • User Authentication
  • Graphics and Animation
  • Sound Effects
  • Betting Options
  • Game Statistics

Next Steps - Features Implementations:

  1. Multiplayer Functionality: Enhance the gaming experience by introducing multiplayer functionality, allowing multiple players to compete against the dealer.

  2. User Authentication: Implement user authentication to provide a personalized gaming experience and enable tracking of individual player statistics.

  3. Game Statistics: Introduce a statistics feature to keep track of players' performance, including win-loss records and other relevant gameplay metrics.

  4. Dealer's Unrevealed Cards: Mimic the real blackjack experience by initially keeping all of the dealer's cards unrevealed. Unveil the cards as the game progresses, following the player's actions.

  5. Enhanced Dealer Interaction: Create a more realistic gaming environment by allowing the dealer to draw a third card based on specific conditions, similar to real blackjack rules.

  6. Improved User Interface: Enhance the user interface to provide a visually appealing and intuitive gaming experience for players.

  7. Integration of Real Blackjack Rules: Further align the game with traditional blackjack rules, ensuring a more authentic representation of the classic card game.

Challenges:

I encountered challenges while running unit tests on a Python file with Flask framework.RuntimeError specifically: "Working outside of application context." Additionally, faced "Unable to build URLs outside an active request" due to missing configurations like 'SERVER_NAME' and 'APPLICATION_ROOT.

Steps Taken:

  • Added Flask app context using self.app.app_context().
  • Modified the BlackjackGame class to handle both Flask and non-Flask contexts.
  • Separated Flask-dependent logic to run only when the context is available.

alt text

alt text

Persisting Issue:

Despite these changes, a RuntimeError persisted, indicating Flask's inability to build URLs outside an active request. I think a configuration change is needed, but I haven't found the solution yet.

Alternate Approach:

To ensure unit testing functionality, I have created a separate Python file, app_blackjack.py, detached from Flask, it is only for testing purposes. This file is connected to test_blackjack.py file, to run unittests.

alt text

alt text

Highlights:

  • Multilingual Development: Crafted the project using a combination of Python and JavaScript.

  • Learning AJAX: Implemented AJAX to enhance the project's scripting capabilities.

  • Python Flask Framework: Leveraged the Python Flask framework for efficient development.

  • AWS (Amazon Web Services): Successfully deployed the project on AWS EC2 instance, it took me 4 days and was challenging but I made it happen.

Developer:

Support:

If you have any concerns or questions, you are welcome to reach out via email at [email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published