Objective of the project was to learn javascipt.
I made this project only for the purpose to learn javascipt and yes making a "blackjack game" in javascipt is a bad idea.
-javascript
-bootstrap
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.
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
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
As the name suggest it use to get a vaue or set a value
It is use to disable buttons when the game is concluded
-It is use to display score
-Display stuff depending who won
Achived the result in 1 day.(since i already made blackjack in java console based i had almost evey functions)
If you know how to play balckjack you can give this a try. Demo in github