JBotwina / BlackJack.java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BlackJack.java

This program is an implementation of Blackjack Solitare. The program creates and shuffles a deck of cards and displays a grid in the console that resembles how the game would be played if observed in real-life. I used a scanner object to recieve user input and change the state of the game. The game has full functionality of a standard Blackjack Solitare game, including the discard pile. Additionally, I designed the game to catch and handle user input errors such as non-integer and out-of-range input as well as if the discard pile is full or the user tries to place a card in a spot that has already been chosen. At the end of the game (when all the spaces on the board are filled), the program scores the final state of the game along each row and column of the board in accordance with standard Blackjack Solitare rules. The most challenging aspect of this project was to decide whether the ace had a value of 11 or 1. If you assign the ace with a value of 1 as a default, then if that row or column's sum is less than 11, it will always be in the player's benefit to have the ace as a value of 11. Conversely, if the row or column's sum is greater than 10, it will always be of the player's benefit to have the ace as a value of 1 or else there would be a bust. Also, there can only be one ace of value 11 in any given row or column.

About


Languages

Language:Java 100.0%