Coder Social home page Coder Social logo

jennilynhowell / 4.2-blackjack-hand-totaler Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2 KB

TIY Week 4, Day 2: A JS program for totaling your blackjack hand

Home Page: https://jennilynhowell.github.io/4.2-blackjack-hand-totaler/

HTML 14.52% JavaScript 85.48%
javascript logic

4.2-blackjack-hand-totaler's Introduction

4.2-blackjack-hand-totaler

TIY Week 4, Day 2: A JS program for totaling your blackjack hand

First off, for anyone new to the game of Blackjack, the basic premise is that you want to have a hand value that is closer to 21 than that of the dealer, without going over 21. Therefore, when playing Blackjack, you always need to be continually keeping track of the value you hold in your hand.

Taking this into consideration, if you were to build a Blackjack game, you would need a function that can take any given hand and return the total value. This would be a function you would use a lot in your game, and this is why we are going to be building this function out.

Start with the starter files below, and upon opening up the index.html file in your browser and opening the JavaScript console, your screen should look similar to the screenshot below.

blackjack-tests.png Your goal is to write a function called handValue that takes an array of cards and returns the total value. The interesting part of this is how Blackjack does the scoring. Here are the rules:

1-10 = Worth face value (1 = 1 point, 4 = 4 points etc) J, Q, K = Worth 10 points each A = Worth 1 or 11 points You'll need to take this into consideration when working through this project.

4.2-blackjack-hand-totaler's People

Contributors

jennilynhowell avatar

Watchers

James Cloos 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.