GithubHelp home page GithubHelp logo

7-16-black-jack's Introduction

#Black Jack Game using jQuery/Javascript, HTML, and CSS.

###A fun game app that harnessess the power of vanilla javascript and jQuery to create an interactive experience for the user as they try to win Blackjack!!! The dynamic display of the cards being dealt uses css transitions and the player is able to place bids, Hit and Stand in order to beat the computer during the game. Once a winner has been identified, the player may reset the game to play again as desired.

Visit here to play: Black Jack

##Built with: - Html - CSS - Javascript - jQuery - Bootstrap

##Sample Code ###The following code was created to allow the player to place a bet before beginning the game. This calculation function will return the values of the players score depending on the win status and the score updates with each iteration of the game. The Javascript has three primary buttond: Deal, Hit and Stand.

function calculateTotal(hand, whosTurn){
	var cardValue = 0;
	var total = 0;
	var hasAce = false; // init ace as false
	for(var i = 0; i<hand.length; i++){
	cardValue = Number(hand[i].slice(0,-1));
		if((cardValue == 1) && ((total + 11) <= 21)){
			//This card is an ace, chech if eleven will fit. it not = 1
			cardValue = 11;
			hasAce = true;
		}
	// console.log(hand[i]);
	// console.log(cardValue);
		else if(cardValue > 10){
		cardValue = 10;
		}
		else if((cardValue + total > 21) && (hasAce)){
			total = total - 10;
			hasAce =false;
		}

	total += cardValue;
	}

	//update the html with the new total
	var elementToUpdate = '.' +whosTurn + '-total-number';
	$(elementToUpdate).text(total);
	return total;
}

####Early stages of game Alt text

##Future Add-ons

  • The ability for two players to play against each other.
  • Clickable chips for placing bets with specific values.
  • A UX/UI design that encourages player usage.

##Team Members from pair-programming ###Please visit our personal profiles to see our current projects.

7-16-black-jack's People

Contributors

shirlazybrat 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.