Coder Social home page Coder Social logo

blackjack's Introduction

Game description:

It's a simplified version of the popular card game Blackjack (without bets).

At the beginning of the game, the 3 players and the dealer are dealt 2 cards each. We see both players'

cards but see only 1 of the dealer's cards. The aim of the game is to have the sum of the card values

(score) in your hand be 21 ( BLACKJACK ), or as close to 21 as possible. However, you lose if y ou go

over 21.

The players go first in turns and have two choices: Hit or Stand. HIT means the player wants to pick

another card. You make this move to increase your score. STAND means that the player is done picking

new cards (i.e. Hitting) and their turn ends. You do this move when you are comfortable with your score

(e.g. score=19 is very close to 21, picking another card could make you lose the game by going over 21

(Player BUSTED ).

When the player's turn ends, the next player starts to play in turns. If the maximum score of all players is

less than the value of the two cards of the dealer's then the dealer will win the game and doesn't need to

hit more cards. Other than that, then the dealer starts hitting until he either scores 21, scores a score bigger

than all of the other players or go over 21 (Dealer BUSTED ).

Finally, if more than one player have the same high score then it's a tie situation ( PUSH ) , but if only a

single player had the maximum score then that player WINs the game

The strategy is to increase your score by hitting to get close to 21 (but not over), while also taking into

consideration what the dealer's score could be.

Game Main components:

  1. Deck creation & initial card draw.

a. Create deck

b. Do the initial card draw for the player and the dealer (a total of 4 cards)

c. Remove drawn cards from the deck

  1. Player's turn (repeated 3 times for the 3 players)

a. Hit or Stand

b. Update the player's score.

  1. Dealer's turn

a. Hit until he either scores 21 ( BLACKJACK ), a score more than the maximum score of the 3 players

or bust.

  1. Make decisions(someone WINS or it's a PUSH ) and end the game.

blackjack's People

Contributors

youmna-younis 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.