https://github.com/nipuna-lakruwan/blackjack-game-js
The BlackJack Game is a simple JavaScript implementation of the classic “21” card game where players aim to beat the dealer by having a hand value closest to 21 without exceeding it.
https://github.com/nipuna-lakruwan/blackjack-game-js
blackjack-game javascript
Last synced: 2 months ago
JSON representation
The BlackJack Game is a simple JavaScript implementation of the classic “21” card game where players aim to beat the dealer by having a hand value closest to 21 without exceeding it.
- Host: GitHub
- URL: https://github.com/nipuna-lakruwan/blackjack-game-js
- Owner: Nipuna-Lakruwan
- Created: 2024-12-26T15:30:23.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-12-26T15:42:06.000Z (4 months ago)
- Last Synced: 2025-01-03T23:28:03.328Z (4 months ago)
- Topics: blackjack-game, javascript
- Language: JavaScript
- Homepage: https://nipuna-lakruwan.github.io/BlackJack-game-js/
- Size: 845 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BlackJack Game
Welcome to the BlackJack Game project! This is a simple implementation of the classic card game BlackJack using JavaScript.
## Table of Contents
- [Introduction](#introduction)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Rules](#rules)
- [JavaScript Topics Covered](#javascript-topics-covered)
- [Contributing](#contributing)
- [License](#license)## Introduction
BlackJack, also known as 21, is a popular card game played in casinos around the world. The objective of the game is to beat the dealer by having a hand value closest to 21 without exceeding it.
## Features
- Simple and intuitive user interface
- Basic game logic for player and dealer
- Ability to hit, stand, and reset the game
- Score tracking## Installation
To get started with the BlackJack Game, follow these steps:
1. Clone the repository:
```bash
git clone https://github.com/nipuna-lakruwan/BlackJack-game-js.git
```2. Navigate to the project directory:
```bash
cd BlackJack-game-js
```3. Open `index.html` in your web browser to start the game.
## Usage
- Click "Start Game" to begin a new game.
- Use the "Hit" button to draw a new card.
- Use the "Stand" button to end your turn and let the dealer play.
- The game will automatically determine the winner and update the scores.## Rules
- The goal is to have a hand value closest to 21 without exceeding it.
- Number cards (2-10) are worth their face value.
- Face cards (Jack, Queen, King) are worth 10 points.
- Aces can be worth 1 or 11 points, depending on which value benefits the hand more.
- The player and dealer are both dealt two cards initially, with one of the dealer's cards hidden.
- The player can choose to "Hit" to draw additional cards or "Stand" to end their turn.
- The dealer must draw cards until their hand value is at least 17.
- If the player's hand exceeds 21, they bust and lose the game.
- If the dealer's hand exceeds 21, they bust and the player wins.
- The player wins if their hand value is higher than the dealer's without busting.## JavaScript Topics Covered
This project covers the following JavaScript topics:
- Variables and Data Types
- Functions and Scope
- Event Handling
- DOM Manipulation
- Conditional Statements
- Loops
- Arrays and Objects
- Basic Game Logic
- Asynchronous Programming## Contributing
Contributions are welcome! If you have any suggestions or improvements, please create a pull request or open an issue.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.