An open API service indexing awesome lists of open source software.

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.

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.