Git Product home page Git Product logo

test's Introduction

Day1 Shuffle note

Day2 BJ NOTES

Since using % might slow down processing speed, I decide to do some tricks to reach the same purpose. Notice that in JS Math.random() will give out numbers between 0 - 1. Therefore, I miltiply by a hundred to make it between 0 - 100.

var randnum = parseInt(Math.random() * 100); var pos = (randnum > 51) ? (randnum - 48) : randnum;

With such a method we can achieve the same goal as modulus operand.

Checksum dealing with double Ace issue can be solved in a quick way. We know that sum can't exceed 22; thus, from the second ace we get, we should all make it value 1.

Basically the whole structure to get cards is a nested while loop with the following conditions. At the inner while loop, representing as a round, as long as sum doesn't exceed 17 and cards player owns doesn't exceed 5, then player should keep getting cards.

while(deck.length != 0 ) { aRound(); }

May have a better solution. Even though I want to deal with out of cards problem in the level of round.

test's People

Contributors

xdewtr avatar

Watchers

James Cloos avatar  avatar

test's Issues

source file problem

Goal: Separate the whole Round function from original html to source
Problem: BlackJack not defined

Goal: Separate the shuffle function and getCards function
Problem: They are combined in class

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.