Giter Site home page Giter Site logo

ga-project1-blackjack's Introduction

#Project 1: BLACK JACK project-deployment -

Overview -

  • Create the game Black Jack using HTML, CSS, and JavaScript.

Rules -

  • Blackjack is typically played with a dealer and either one or more players.
  • Card values range from 2-9, 10 (Jack, Queen, King), and either 11 or 1 (ace)
  • Ace value is 11 by default, but changed to 1 if your current hand will be > 21.
  • On the start of each round, 2 cards are dealt to each player and the dealer.

Game Objective

  • To achieve a score of 21 or less and beat the dealer's hand.

#Project Developement

  • Researching Blackjack Fundamentals

  • Drawing a basic game board concept

  • Identifying project obstacles/tasks to be completed

  • organizing obstacles/taks/bugs to follow project developement process

  • Developing a control flow on paper

  • converting game board concept to digital wire frame for manipulations/mapping

  • Constructing a digital layout

##Tech Used

  • Program Languages: HTML, CSS, Javascript
  • Git project/issue management: GitKraken
  • Wireframing: draw.io

##Src for shuffle/randomize

Fisher-Yates Shuffle

##Src for Images

src for playing cards: --

ga-project1-blackjack's People

Contributors

sageguy09 avatar

Watchers

James Cloos avatar  avatar

ga-project1-blackjack's Issues

function: onLoad()

  • set css/default values
  • display OnStartPrompt
  • call getPlayerName()
  • call shuffleDeck()
  • statusPrompt - "hit/stay"
  • close onStartPrompt

Advanced CSS

  • correcting structure
  • add scheme
  • fonts
  • site images

function: chkCurrentScore():

  • cond1: if currentPlayer score > 21
  • cond1: statusPrompt = " player/dealer bust. you win/lose"
  • cond1: return play getPlayAgain()
  • cond2: else if score <21 and currentPlayer=dealer
  • cond2: statusPrompt = "Dealer current score is (currentScore)"
  • cond3: else "hit or stand?"

Correct currentScore function flow

CurrentScore logic displays win/lose message. CurrentScore does not set currentScore for dealer/player, and does not take in account that the dealer needs a chance to tie your blackjack. Create setCurrent Score to add to dealer/player score var. Current score should

  • Correct getCurrent Score to display win message if playerScore>dealerScore
  • Create setCurrentScore
  • setCurrentScore(plr/dlr, handScore) = set player/dealer score

append player hand cards to gameboard

append cards to playerhand element on gameboard. cards are pulled from deck and placed to players hand on dealCards() function.

  • after initial deal both cards should be shown
  • after hit button is clicked.
  • implement logic for on dealer turn to show hidden card and each card after

listener: dealButton:

  • set dealCount = '0'
  • call dealCards() (dealCount <= 1 loop)
  • current(player/dealer) = sum dealtCards

Build core HTML elements

Create the core HTML elements to be used in the gameBoard

  • gameBoard
  • deck
  • playerHand
  • dealerHand
  • cards[1-6] for Hands
  • resetBtn
  • stayBtn
  • statusPrompt
  • hitBtn
  • player/dealer score
  • onStartPrompt
  • onSubmitBtn
  • onPlayerName

function: setCurrentScore(player/dealer, handScore):

  • cond1: if player = player
  • cond1: currentPlayerScore = handScore
  • cond2: if player = dealer
  • cond2: currentDelaerScore = handScore
  • replace tasks for cond2 with an updated currentPlayer from standBtnclick/checkCurrentScore (if currentPlayer == players.length;)

HTML Wire Frame:

  • Create main html wireframe for game on draw.io
  • Label elements and tags
  • color/identify elements based on temp/perm/connected elements (defined via js wire frame)
  • export final wire frame design to image within /project

Basic CSS

  • gameBoard - color, size, border
  • H1 - alignment
  • playerHand div and children (cards) - flex container buil, align top center of gameBoard, d and alignment of children flex item
  • dealerHand div and children (cards) - container buil, align top center of gameBoard, d and alignment of children lignment of children flex item
  • playerScore: shape, align
  • dealerScore: shape, align
  • deck: shape, align
  • hitBtn: shape, align
  • stayBtn: shape, align
  • resetBtn: shape, align

listener: onStartPrompt submit

set playeName value from entered text (default=Player). callShuffleDeck to copy/randomize deck(objects).

  • set playerName = onPlayerName value
  • create if for null value from onPlayerName
  • call shuffleDeck()
  • call dealCards();

JS Wire frame:

  • list out all functions and elements to be called
  • map functions to follow route defined in markup file/project task
  • export final design to image with /project

function: getPlayAgain():

  • set playAgain button to call onStart to deal new hand and reset previous game standings/gameboard.

Initialization -

Create project initial files and commit to project repo:

  • create pull project repo to local directory
  • create readme, index, css, and js files in project directory
  • create project folder with project planning files
  • commit/push initialization

function: .onSubmitPromp.submit()

  • if value true: set playerName value = onPlayerName
  • if value false: set playerName value = "PlayerOne"
  • create function to pass value to playerName global varaible

Ace logic

create logic for ace 1/11 based on standard blackjack rules.

  • create function to set ace value when setCurrentScore iterates.

array: deck[{cards}]

Create array with 52 objects containing card properties: cardVar, cardSuit, cardVal, cardImg.

function: dealCards():

  • dealCount, currentPlayer, player/dealerScore = 0
  • construct objects in players array for each player
  • loop1 = dealCount <=1
  • loop1 : deal card[1-2] to player/dealer from shuffledDeck
  • loop2: dealCount >=2 and currentScore < 21
  • loop2: deal cards to player/dealer from shuffledDeck
  • replace loop2 check with set/chkCurrentScore.

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.