Newer
Older
## By twentyonecoders :
## What is the project about?
Our project is a BlackJack game implemented in Java using JavaFX.
For reference please refer to https://en.wikipedia.org/wiki/Blackjack.
We are still working on multiplayer for this application but that feature is still
in development.
BackJack, a game that keeps you entertained during the hardest times. Even if you have no friends or your internet
connection is lost, this game is always playable* and you are in safe hands, since you are not playing with real money.
The player starts with an initial amount of 2000 virtual coins and the game follows the basic blackjack rules,
where the user plays against the dealer. The main goal of the game is to beat the dealer's hand without going over the value of 21.
The landing page is first to appear when opening the application. The user can choose his name and join a game.
Before each round he can bet whatever amount of owned money he wants. When te round starts he gets assigned different cards.
There is the possibility to “hit”, which means to ask for another card, or to “stand” if the player is happy with
the final value and thinks he can outplay the dealer. If the player wins, he gets double the amount of money he bet,
otherwise he will lose the amount of money he bet.
But what happens if you have an unlucky hand and go bankrupt? Don’t worry! The game is not over yet, since there
is no game over. You get another 2000 virtual coins and can go on playing.
If you think the game keeps you prisoner, that is not the case. It might be that you become a little obsessed with it,
just like we did, but after each round the game gives you the possibility to leave it.
And obviously you know the simple keybinding “Alt + F4”.
Our main goal was to create a friendly environment where the player can forget about the world for a few moments and
enjoy gambling at its best. Music will play in the background and the user interface is colorful and easy to use.
We wish you a lot of fun!
*you might need electricity
## programming techniques used
1. Collections
2. Custom Exception
3. Exception handling
4. Method overriding
5. Lambdas
6. Streams
7. File I/O
8. Regex
9. Observer pattern
10. Test hooks
11. serialization
these might change when using an IDE (eg. IntelliJ or Eclipse), where you can run the maven goals from the IDE directly.
###download or clone the project
1. Download the project from gitlab or clone it using ssl or https.
5. Run `mvn javafx:run` to run the app.
### to package the project and obtain a runnable jar file
Run `mvn clean package`. It creates 2 jar files, where blackjack-BLACKJACK.jar is the runnable jar file.
### execute the jar file
to execute the jar file run `java -jar blackjack-BLACKJACK.jar` (when executing you must be in the same
folder as the jar file)
## Problems running the application ?
please message us on LeKerschbaumer@unibz.it
- Java 15 or above https://www.oracle.com/java/technologies/javase-downloads.html
- maven download: https://maven.apache.org/download.cgi; installation guide: https://maven.apache.org/install.html
## Usage
This application is an implementation of the popular card game Blackjack.
The user enters a username and clicks on `start`. The application then proceeds to the
main scene. If the player is unsure about the rules the info button in the top left corner
may be clicked to show the games rules. The chips at the top of the screen are clickable buttons with which the user can
bet virtual money. In the top right corner the player's money can be seen. Bets and wins
are subtracted and added to the player's money accordingly. When the player has carried out
the bets, he can press the `ready` button, and the initial card will be dealt. The player
may press `hit` or `stand` now. By pressing hit another card will be dealt. By pressing stand
on the other hand, the player's turn ends, and the dealer may request further cards.
At the end of the wound a pop up appears and informs the player about the result. Afterwards
two options are presented:
- continue
- exit the game
## Implementation
To implement this project we used the javaFX.
1. We used `collections` (lists) to save the cards in hand and deck.
2. Custom Exception are thrown when a certain case arrives during the game
ex. when no bet is set and the player wants to start the round
3. Exceptions are handled so the application does not crash unexpectedly
4. Method overriding ex. toString..
5. Lambdas for event listeners
6. Streams
7. File I/O for card backs
8. Regex to check username does not contain special characters
9. Observer pattern by using event listeners
10. Test hooks
11. serialization for log
We use some basic classes as logic (Hands, Player, Deck, Card). The GUI uses JavaFX
while the logic for the GUI resides in a controller.
.
.
.
## Our experience in this project
We organized ourselves using an application called Clickup. It allows us to create
tasks and notes as well as assign those tasks to a team member. It also features
a mindmap and other functionality which helped us to keep track of what needed to be done.
Git helped us share our code. We used feature branches to develop different parts of the
project for example the logic or the gui.
## Licensing
Copyright 2021 twentyonecoders
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
A copy of the license is available in the repository's license.txt file.