Black jack in java

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A Java Blackjack implementation

License

joeraut/blackjack

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Читайте также:  Python connected components opencv

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Simple Blackjack game in Java, with GUI

Main image

This is a one-player blackjack game, where the player plays against the dealer.

The game is written in Java (developed in Eclipse) using Swing/AWT for the GUI.

Standard Blackjack rules are used:

  • Dealer stands on 16
  • Aces have a value of 11, unless total is >21 — if so, then the Ace assumes a value of 1. If more than one Ace is present, only one can change value.

Each card is an instance of Card , stored in a CardGroup and the contents of a CardGroup can be displayed as a CardGroupPanel , an extension of Swing’s JPanel . The game contains 3 instances of CardGroup — one for the dealer’s initial (shuffled) deck, and two for the player and dealer cards which are displayed using CardGroupPanel . Cards are popped from the dealer’s deck and added to the player or dealer card group each time a player hits or dealer takes a card. The code is well commented so should be pretty easy to understand.

After cloning or downloading, it should be possible to import directly into the Eclipse IDE (or similar). Source files are located in src ; when compiling, be sure to include the image resources in the repo root.

The player sets an initial balance, deals and then hits or stands until either getting a blackjack, winning, losing or pushing. When out of money the option to top up or end the game is given.

About

A Java Blackjack implementation

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Simple blackjack program in Java.

0reldev/blackjack

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Simple black-jack game coded in Java

During my web developper training course at the Wild Code School, I’ve been asked to code a simple black-jack game in Java to practice the basics.

There are two players: the Player (us), and the Dealer (a bot). Each player will draw two cards, turn by turn, starting by the Player. When the Player’s turn ends, the addition of the two cards are added to his current score (itinialized to 0). When the Dealer plays, only one of its cards is revealed, and the other one is face-down. The Player has to decide if he continues to draw cards or not for trying to get as close as possible to the score 21 without exceeding it.

If the Player’s score exceeds 21, he loses even if the Dealer exceeds 21 too.

If the Dealer exceeds 21 and the Player doesn’t, the Player wins.

If the final score of the Player is higher than the Dealer’s one without exceeding 21, the Player wins.

If an Ace is drawn, the Player can decide is a 1 or a 11 is considered.

Faces cards (Jack, Queen and King) are all worth 10.

Program execution examples

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Blackjack game in Java with Swing components

krauss/Blackjack

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

♣️ ♥️ The BlackJack Game ♠️ ♦️

A pretty basic implementation of the famous game BlackJack, written in JAVA using native Swing components, SQLite as the internal database, MigLayout as the layout manager and Flatlaf as a third-party look-and-feel provider.

Login_screen

You can either clone this repository and setup a workspace in your IDE or simply download the latest jar file in our releases folder. To create a new player and start playing, just type an username and a checkbox will appear as soon as you start setting your password. Then tick the checkbox to create it and click Login .

Login_screen

If the checkbox does not come out, it means the username you picked already exists in the database, so pick another one.

If you are a JAVA GUI application & Docker master, feel free to try to help me fix the problem below which is preventing us from having a pretty cool and functioning Docker image of the game.

Once you have Docker CE installed an running, from your Linux terminal or Windows cmd, type:

$> docker pull jrkrauss/blackjack:latest

Create the container and run/ship it 🚢

$> docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY jrkrauss/blackjack:latest

P.S: This is the problem I mentioned before. The container execution exits with the error below:

No protocol specified Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable. at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:99) at java.base/java.security.AccessController.doPrivileged(AccessController.java:312) at java.desktop/sun.awt.X11GraphicsEnvironment.clinit>(X11GraphicsEnvironment.java:58) at java.desktop/sun.awt.PlatformGraphicsInfo.createGE(PlatformGraphicsInfo.java:36) at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:93) at java.desktop/java.awt.GraphicsEnvironment$LocalGE.clinit>(GraphicsEnvironment.java:84) at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:106) at java.desktop/sun.awt.X11.XToolkit.clinit>(XToolkit.java:232) at java.desktop/sun.awt.PlatformGraphicsInfo.createToolkit(PlatformGraphicsInfo.java:40) at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:592) at java.desktop/java.awt.Toolkit.getEventQueue(Toolkit.java:1483) at java.desktop/java.awt.EventQueue.invokeLater(EventQueue.java:1312) at java.desktop/javax.swing.SwingUtilities.invokeLater(SwingUtilities.java:1421) at com.eca.assignment.main.Main.main(Main.java:11)

About

Blackjack game in Java with Swing components

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A Blackjack game with GUI written in Java.

uzaymacar/blackjack-with-gui

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

This project was done by Ongun Uzay Macar as a final project for Advanced Programming (high school class) in January 2016 in the guidance of Cengiz Agalar. It is the Java implementation of the popular card game BlackJack supplemented with a graphical user interface.

Screenshot Screenshot Screenshot Screenshot Screenshot

src : This directory contains all the Java source files (classes) that are detailed below.

images : This directory contains images that will be displayed to the player to enhance gameplay.

sounds : This directory contains sounds that will enhance user gameplay and add in a casino ambience.

Card.java ->Card Class: This class is for the card itself. The printCard method prints the cards which are stored in a 2D array.

Deck.java ->Deck Class: With the deck class, we form a deck that consists of 52 cards. There are methods to shuffle, add, and remove cards.

Game.java ->Game Class: This class calculates the Blackjack game itself. It starts the game, forms the hands, checks the hands for a blackjack or bust. It calculates who wins each round and what happens when a round is over.

GameComponent.java ->GameComponent Class: This class is for the overall atmosphere of our game. When the user clicks the play button in OptionsComponent (menu), this component opens with the poker table, poker chip, and the cards, and all other stuff.

OptionsComponent.java ->OptionsComponent Class: This class is for the menu in our program. In our menu, we have some buttons.

Tester.java ->Tester Class: The tester class is the main class of our program. It will run when you click run in your IDE of choice that runs Java. In the Tester class, there are two threads. One of those threads are for the checking of the game which means that the game will refresh as each round finishes and starts again. The other is for the refreshing of the JComponent and the display served to the player.

About

A Blackjack game with GUI written in Java.

Источник

Оцените статью