Skip to content

PowerThrower/CardGames

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CardGames

CardGames is a small, personal project that makes use of Java to replicate as accurately as possible the rules and gameplay of classic card games, using cards with one of four suits (diamond, heart, spade, club) and one of thirteen ranks (ace, two, three, four, five, six, seven, eight, nine, ten, jack, queen, king) as can be found in a standard deck of 52 cards. What sets this project apart from common card game simulations is that the user can import and use decks of their own design as .txt files, so long as said decks only have cards with one suit and one rank each from those listed prior. The deck as a whole must also have enough cards and associated scores to support the non-playable program card dealer and at least one player, depending on the game.

Available Games

The following are the card games that are currently available to play:

  1. Blackjack: Blackjack, alternatively referred to as 21, is a game where the dealer draws cards from a given shuffled deck and deals two to each player and themselves. Each group of two cards is known as that player's/dealer's hand. Scores are the sum of the values of the individual cards, with pip cards (two to ten, excluding the ace) worth the number on the card, face cards are worth 10, and the ace is typically worth 11. The dealer's second card is not shown to the players, and the score is based on the dealer's only visible card until the second card is revealed. Once the cards have been drawn and dealt, the round begins by first checking if the dealer and any player has a score of 21, known as a blackjack. If the dealer has a blackjack, the round immediately ends, and players tie with the dealer only if they also have a blackjack, losing otherwise. If one or more players have a blackjack, and the dealer does not, they automatically win and their turn is skipped. If not, then the turn of the first player without a blackjack begins. Should the player have two cards of the same rank, such as two fives, they can choose to split their hand, creating two hands of cards with separate scores that are played one after the other. Regardless of the choice, the player is presented with the option to 'stand,' or not draw any additional cards, or 'hit,' or draw an additional card, for the hand they are playing. If the player chooses to 'stand' at any point, they are considered done with that hand, and the sum of the card's values is the final score of that hand. If the player chooses to 'hit,' they receive a new card in their hand whose value is added to that hand's score. The goal is to get as close to a score of 21, including 21, without going over or overdrawing, at which point the player automatically loses with that hand. Once every player has played all of their hands, the dealer's turn begins, at which point they reveal their second card and draw cards until they have a score of at least 17, at which point they automatically stand, or overdraw. Once the dealer's turn is over, the round is considered over, and the scores of the player's hands are compared to those of the dealer. If the player's hand has a higher score than the dealer's, they win with that hand, while an equal score means a tie and a lower score is a loss with that hand. If the dealer overdrew, then the player wins with any hand of theirs where they did not overdraw. This game relies on a combination of strategy and luck, with players attempting to use their scores and the dealer's known scores to decide if they should draw cards to get a higher score at the risk of potentially drawing, or standing in the hopes of getting a higher score than the dealer or that the dealer overdraws. For this version of blackjack, The player can only split their hand at the start of their turn, and the dealer cannot split their hand or stand below a score of 17.

How to Use

Currently, the project lacks an executable file to run. If you wish to play regardless, you will have to download the project from the link to the repository at the top of the page, unzip it, and run the class file corresponding to the card game you want to play. For instructions on how to do so, look up how to run a java class via your command prompt, or open the program using an Integrated Development Environment (IDE) such as Eclipse and run it via the provided options. An executable file will be prepared and provided in the project's near future.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published