Giter Club home page Giter Club logo

blackjackproject's Introduction

Blackjack

Week 4 Homework Project for Skill Distillery

Overview

This program utilizes OOP principals to create and play Blackjack. There are two packages used. One is a common package containing Card, Deck, Rank, and Suit. The other package is specific to Blackjack, and contains many Classes used for gameplay.

Upon launch, the user is asked if he/she wants a CardCounter player to play.

Welcome to BLACKJACK

Do you want your card counting friend to play with you? (y/n)

If the user selects 'n', the gameplay will only be between the player and the dealer.

Do you want your card counting friend to play with you? (y/n)
n
Player hand= [EIGHT of Hearts, ACE of Diamonds] Player 19
Dealer hand= [KING of Spades, xxxxxxx]

Gameplay continues and the user is able to 'hit' or 'stay'.

Hit or Stay?
stay

Dealer hand= [KING of Spades, QUEEN of Diamonds]
Dealer hand: 20
Dealer wins!
Play again?? y/n
Player hand= [EIGHT of Clubs, EIGHT of Diamonds] Player 16
Dealer hand= [THREE of Spades, xxxxxxx]

Hit or Stay?
hit

[EIGHT of Clubs, EIGHT of Diamonds, NINE of Clubs]
Player hand: 25
Player BUST
Dealer wins
Play again?? y/n

Gameplay with CardCounter

If the user elects to play with the CardCounter, he/she will be able to see suggestions passed by CardCounter based on the count. The CardCounter counts cards based off the popular Hi-Low strategy. During gameplay, only one deck is used. Once fewer than 8 cards remain in the deck, a new deck is created.

Do you want your card counting friend to play with you? (y/n)
y
CardCounter will play first..

Player hand= [FOUR of Hearts, THREE of Clubs] Player 7
Dealer hand= [SEVEN of Spades, xxxxxxx]
Card Counting Player hand= [TWO of Hearts, SEVEN of Diamonds] CardCounter 9

Card count is 3, BET BIG
CardCounter hitting..
[TWO of Hearts, SEVEN of Diamonds, QUEEN of Spades]19

CardCounter stays at 19
Hit or Stay?

The CardCounter plays first. After analyzing the hand, CardCounter gives advice. Then CardCounter hits or stays based off his logic & the count.

After CardCounter's turn, the player is up and gameplay continues.

Technologies/Topics Applied

  1. Object Oriented Programming - The Blackjack program is designed with good OO structure in mind. There are multiple Classes that can be used for any card game.
  • Abstraction - The Class Hand is abstract in my program because it implements an abstract method. The class BlackjackHand extends Hand and defines it's own method. This allows Hand to be used for multiple different games if created in the future.
  • Inheritance - The main example and use of Inheritance in this program is the parent class Person. Player, Dealer, and CardCounter are all 'Persons' (children of Person), and incorporate most behaviors.
  • Encapsulation - All of the Classes have private variables, as well as a few private methods.
  1. Enums
  • Enums were very useful when designing the Card's suit and rank. Since it is defining a collection of constants, it worked very well.
  1. UML Diagrams
  • Since this program manipulates and calls many classes, a UML diagram was very helpful.

blackjackproject's People

Contributors

jaredm3 avatar

Watchers

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