Giter Site home page Giter Site logo

blackjack-typescript's Introduction

Also Check out the Python Version of this Project!

Blackjack-Typescript

image

Overview

The Blackjack project is a console-based simulation of the Blackjack card game, also known as 21. Developed in Node.js, it showcases Object-Oriented Programming (OOP) principles and adheres to the SOLID design principles. The game features a dealer (computer) and a player (user), with the ability to hit or stand as per the classic game rules.

Setup

Requirements

  • Node.js installed on your system.
  • npm (Node Package Manager)

Installation

  1. Clone the repository to your local machine.
  2. Navigate to the project directory.
  3. Install dependencies:
    npm install

Running the Game

To start the game, run:

npx tsx index.ts

Follow the on-screen prompts to play Blackjack against the computer.

Project Structure

The project is organized into several key components:

  • Deck: Manages a collection of playing cards.
  • Hand: Represents a hand of cards for a player or dealer.
  • PlayingCard: Defines a single playing card.
  • BlackjackHand & DealerHand: Specialized hand classes for the player and dealer, respectively.
  • Game: A base class for game logic.
  • Blackjack: Extends Game with specific logic for Blackjack.

Testing

The project includes unit tests to ensure the reliability of key functionalities like card handling, deck operations, and game logic.

Running Tests

Tests are implemented using Jest. To run the tests, execute:

npm test

License

The Blackjack project is open-sourced under the MIT license.

blackjack-typescript's People

Contributors

jll38 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.