Skip to content

BlackJack game written in vanilla JavaScript, HTML, CSS.

License

Notifications You must be signed in to change notification settings

ozhasta/vanilla-js-blackjack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlackJack game

Simple BlackJack game, play against dealer.


BlackJack


Live Demo

Live demo here: ➡️ BlackJack

Description

Written in vanilla JavaScript, HTML, CSS. The special thing about this project for me, is that: I wrote it on my own without reading any other BlackJack code or without watching the tutorial.

All the necessary rules have been added to the game and are operational. I implemented my own CSS animations for better visuals & feels.

Acknowledgments

Fisher–Yates shuffle algorithm: Due to the weakness of the JavaScript's built-in shuffling while sorting1, during development I found different shuffling algorithm that working much better, and that's the only part I've used code from the web. See, below.

for (let i = arr.length - 1; i > 0; i--) {
  let j = Math.floor(Math.random() * (i + 1))
  ;[arr[i], arr[j]] = [arr[j], arr[i]]
}

Footnotes

  1. Compare Naive Swap vs Fisher–Yates

About

BlackJack game written in vanilla JavaScript, HTML, CSS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published