Code Monkey home page Code Monkey logo

blackjack's Introduction

Blackjack Game

This is a simple simulation of the blackjack card game, written in Python. The game involves one dealer and four bot players.

How the Game Works

When the game starts, the dealer and the bots are each dealt two cards. The bots then take turns deciding whether to "hit" (take another card) or "stand" (take no more cards). Bots may also "double" (double their initial bet and receive only one more card) or "split" (if they have two cards of the same rank, divide them into two hands and continue playing each hand separately).

The goal for each bot is to have the sum of their cards be higher than the dealer's without exceeding 21. The dealer must hit until their cards total 17 or more, at which point they must stand.

How the Bots Make Decisions

Bots make decisions based on simple logic:

  • If the total value of a bot's hand is less than 17, the bot will always hit.
  • If the total value of a bot's hand is 17 or higher, the bot will always stand.
  • If a bot has two cards of the same rank, it will always choose to split.
  • A bot will choose to double if its hand value is 11.

Running the Game

To run the game, simply execute the Python script blackjack.py:

python blackjack.py

blackjack's People

Contributors

alexcanc 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.