Giter Site home page Giter Site logo

blackjack's Introduction

In this task, I designed the game following wikipedia guidelines for a blackjack game (without bets) and created a generic french-suited cards for cards with the following properties:

  • CardColor enum (Red,Black),
  • CardSuit enum (Clubs, Diamonds, Hearts, Spades),
  • CardNumber enum (Ace,Two..Ten,Jack,Queen,King),
  • CardName string : CardColor + CardSuit + CardNumber

The instructions for the blackjack game are found in Blackjack class and helper extensions can be found in DeckHelper.cs

In constructor of Blackjack class:

  • Players are created and stored in "players" list
  • RemainingCards class is instantiated and Cards are created using Generate method in DeckHelper by creating with the combination of CardSuit enum and CardNumber multiplying with the deckCount.
  • And then Cards in RemainingCards are shuffled using Shuffle extension located in DeckHelper

In Play method of Blackjack is designed as a kind of an AI or in other words decision trees supported with RNG:

  • Cards are dealt for the first round by Popping from Cards stack in RemainingCards and pushing to each Player's hand
  • Creating a do while loop with the following instructions:
    • Calculating the sum of card numbers in a player's hand
    • Guessing if the player would hit or stand
    • If players exceed 21, they are removed from the players list.
    • If players hit 21, they win.
    • If a player's hand value is not the highest, player is forced to ask for a card.
    • If the remaining players have the same value and no one hits a card for the round, the round is considered a tie
    • If only one player left, they are considered winner.

blackjack's People

Contributors

mburakeker avatar

Watchers

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