Git Product home page Git Product logo

blackjack's Introduction

Blackjack

The implementation of a simplified version of the card game Blackjack, also sometimes called 21.

It is a relatively simple game played with a standard deck of 52 playing cards. There are two participants, a dealer and a player. The player starts with a bankroll, and the game progresses in rounds called hands.

Blackjack, also known as twenty-one, is a comparing card game between usually several players and a dealer, where each player in turn competes against the dealer, but players do not play against each other. It is played with one or more decks of 52 cards, and is the most widely played casino banking game in the world.

The objective of the game is to beat the dealer in one of the following ways:

  • Get 21 points on the player's first two cards (called a "blackjack" or "natural"), without a dealer blackjack;
  • Reach a final score higher than the dealer without exceeding 21; or
  • Let the dealer draw additional cards until their hand exceeds 21.

(from Wikipedia: Blackjack)

The implementation gives the the Deck ADT, the Hand Interface and the Player Interface (with two different AI players with distinct strategies) and the Driver program. The detailed files are summarized as

  • deck.cpp: the Deck ADT implementation
  • hand.cpp: the Hand ADT implementation
  • player.cpp: the two player ADT implementations
  • blackjack.cpp: the simulation driver

Usage:

  1. Compile the file to generate the program blackjack.
g++ -Wall โ€“o blackjack blackjack.cpp card.cpp deck.cpp hand.cpp player.cpp rand.cpp
  1. Run the program blackjack with the argument in the format <bankroll> <min-bet> <hands> <simple|counting> [<input_file_name>] .
  2. The program will simulate the game process automatically for you. :)

Have fun with Blackjack! XD

blackjack's People

Contributors

youdymoo avatar

Watchers

James Cloos 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.