{"id":21417244,"url":"https://github.com/f5f0a0/blackjack","last_synced_at":"2025-07-26T22:05:05.979Z","repository":{"id":243971988,"uuid":"813926330","full_name":"F5F0A0/Blackjack","owner":"F5F0A0","description":"Text-based Blackjack simulator in C with natural Blackjack detection and dynamic ace handling.","archived":false,"fork":false,"pushed_at":"2025-01-03T20:07:51.000Z","size":795,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T19:19:18.675Z","etag":null,"topics":["blackjack","c","c-programming","c-programming-language","game-development","simulator","single-player","terminal-game","text-based-game"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/F5F0A0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-12T02:28:09.000Z","updated_at":"2025-01-03T20:07:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"76914501-762c-4517-8978-2bff3d4c0c20","html_url":"https://github.com/F5F0A0/Blackjack","commit_stats":null,"previous_names":["f5f0a0/blackjack"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F5F0A0%2FBlackjack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F5F0A0%2FBlackjack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F5F0A0%2FBlackjack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F5F0A0%2FBlackjack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/F5F0A0","download_url":"https://codeload.github.com/F5F0A0/Blackjack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243918629,"owners_count":20368745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blackjack","c","c-programming","c-programming-language","game-development","simulator","single-player","terminal-game","text-based-game"],"created_at":"2024-11-22T19:14:14.424Z","updated_at":"2025-07-26T22:05:05.968Z","avatar_url":"https://github.com/F5F0A0.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blackjack Simulator\n\nWelcome to **Bridget's Virtual Casino!** This is a single-player Blackjack simulator built in C.\n\n---\n\n## Table of Contents\n- [Features](#features)\n- [Getting Started](#getting-started)\n- [Gameplay](#gameplay)\n- [How It Works](#how-it-works)\n- [Code Structure](#code-structure)\n- [Future Enhancements](#future-enhancements)\n- [Author](#author)\n\n---\n\n## Features\n- Single-player Blackjack against the computer dealer.\n- Implements standard Blackjack rules:\n  - Dealer must hit if their hand is less than 17.\n  - Aces can be counted as 1 or 11 depending on the player's advantage.\n  - Natural Blackjack detection.\n- Continuous gameplay with the option to quit at any time.\n- Random card dealing using `rand()` for an infinite deck simulation.\n\n---\n\n## Getting Started\n\n### Prerequisites\nTo run this project, you'll need:\n- A C compiler (e.g., GCC).\n- Basic familiarity with terminal/command-line usage.\n\n### Compilation\nCompile the program using the following command:\n```bash\ngcc -o blackjack blackjack.c\n```\n\n### Running the Program\nRun the executable to start the game:\n```bash\n./blackjack\n```\n\n---\n\n## Gameplay\n\n1. The dealer and player are each dealt two cards at the start.\n2. The player chooses to:\n   - `hit` to draw another card.\n   - `stand` to end their turn.\n   - `quit` to exit the game.\n3. The dealer plays their turn automatically according to Blackjack rules.\n4. The winner is determined based on the totals of the hands:\n   - Natural Blackjack wins immediately.\n   - A hand closer to 21 without exceeding it wins.\n   - Ties result in a draw.\n\n---\n\n## How It Works\n\n### Card Dealing\n- Cards are represented as integers (1-10).\n- `rand()` simulates an infinite deck with probabilities adjusted for Blackjack.\n\n### Hand Tallying\n- Aces are dynamically counted as 1 or 11 depending on the player's best outcome.\n\n### Gameplay Logic\n- The dealer's second card remains hidden until their turn.\n- Comprehensive checks for busts, ties, and Blackjack rules.\n\n---\n\n## Code Structure\n\n### Main Components\n- `deal_card()`: Simulates drawing a random card.\n- `tally_hand()`: Calculates the total of a hand.\n- `reset_hand()`: Prepares hands for a new round.\n- `get_input()`: Reads and processes player input.\n- `print_cards()`: Displays the current cards and totals.\n- `check_naturals()`: Checks for immediate Blackjack outcomes.\n\n### Design Philosophy\nThe code uses arrays to represent hands and separate arrays for handling Aces. Modular functions keep the gameplay logic organized and easy to debug.\n\n---\n\n## Demo\n\n### Game Start\nThe game begins with a welcome message and initial card deals:  \n\u003cimg src=\"assets/game-start.png\" alt=\"Game Start\" width=\"35%\"\u003e\n\n### Player Wins\nAn example where the player wins by standing with a higher hand than the dealer:  \n\u003cimg src=\"assets/player-win.png\" alt=\"Player Wins\" width=\"35%\"\u003e\n\n### Dealer Busts\nThe dealer busts, and the player automatically wins:  \n\u003cimg src=\"assets/dealer-bust.png\" alt=\"Dealer Busts\" width=\"35%\"\u003e\n\n### Dealer Wins\nAn example where the dealer wins by having a higher hand than the player:  \n\u003cimg src=\"assets/dealer-win.png\" alt=\"Dealer Wins\" width=\"35%\"\u003e\n\n---\n\n## Future Enhancements\n- Add a betting system to simulate real casino gameplay.\n- Implement a graphical or web-based UI for a more immersive experience.\n- Enhance card-dealing randomness using cryptographic libraries.\n- Support multiple players.\n\n---\n\n## Author\n**Bridget Brinkman**  \nGitHub: [@F5F0A0](https://github.com/F5F0A0)  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff5f0a0%2Fblackjack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff5f0a0%2Fblackjack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff5f0a0%2Fblackjack/lists"}