/blackjack_javascript

blackjack game using java-script with demo

Primary LanguageHTML

BLACKJACK USING JAVASCRIPT

Objective of the project was to learn javascipt.

ABOUT GAME

I made this project only for the purpose to learn javascipt and yes making a "blackjack game" in javascipt is a bad idea.

TECHNOLOGY

-javascript
-bootstrap

PAGES

There is only one "index.html" page. But it has more than 40 functions which perform in a syncronized manner to make the game run smooth.
I have distinguish the functions into 7 types namely game functions, supporting functions, getters, setters,disable, display and winning.

Game functions

The most important functions which helps the program to run the game.

loadGame- it genrate 52 cards and shuffule it. and after that it deals the first card to the user and second card to himself and then tird to the user agian.
hit- As soon as the user click hit. the dealer deals a card to user.
stand- As soon as the user click stand the dealer stops dealing card to user and deal card to himself
double- This is nothing buut a senario when user perfoms hit function and then stand with doubling the winning
newGame- Use to load a new game

Supporting functions

The second most important type of functions which indirectly helps the program to execute.

cardValue- it returns the value of the card
checkOutput- Return who is winning
checkIfBurst- Check if the user is busted.
checkForBlackJack- Check if its a balckjack.
getImage- Get the cards image to dispyed
checkifAuser- check if the user is having ace.(because it has 2 values 1 or 11)
checkifthisisaceUser- check if a card is ace
checkifthisisaceDealer-check if a card is ace
shuffle- Shuffle the card

Getters and setters

As the name suggest it use to get a vaue or set a value

Disable

It is use to disable buttons when the game is concluded

Display

-It is use to display score

Winning

-Display stuff depending who won

RESULT

Achived the result in 1 day.(since i already made blackjack in java console based i had almost evey functions)

LIVE

If you know how to play balckjack you can give this a try. Demo in github