SLP KBIT Advent Calendar 2018 12/5 I made a roulette wheel using Java in a university experiment, so I will introduce it. GitHub. Originally, I was planning to introduce another artifact, but I didn't have enough time to complete it.
The one in the casino. Wikipedia. There are American style and European style. In the American style, 0/00 exists in addition to the numbers 1 to 36. The European formula is only 0. This time, I chose the American style because I thought that even numbers would be more convenient for programming reasons.
We have confirmed the operation with Java> = 9. The reason for using Java is that it was specified in the experiment. heavy.
Some rules have been simplified for the sake of simplicity.
Roulette has special places such as SMALL and RED. This is expressed as an int type by using the following values. I want to replace it with an enum.
AnyNumMoney There are the following variables.
Also, as a Static variable, the place where you bet and the number of times you make money are saved separately. By treating this as an array, it is possible to handle where and how much you are betting, and you can obtain the number of the array in which the next value is stored. There is reset as a public method. This initializes all values.
Use the anyNumNomeyNormailize method to normalize the AnyNumMoney array. This is because the element that saves only the place to bet or only the money and does not save the other is useless and is canceled. The public methods are as follows.
void setLock(beelean) You will not be able to bet. In an actual casino, you cannot bet due to the time limit. Realize it.
beelean getLock() Get if you can bet now.
AnyNumMoney getNumMoney() Returns an array that stores where and how much you are currently betting.
int getIntRouletteValue() Take with int.
String getStringRouletteValue() Take with String.
MyColor Returns the Color type.
Call the BalMain class as Windows.
Since the BallMain Window operates in a separate thread, if you call it directly from the Main method, the processing of the Main method will proceed before the roulette is finished.
To prevent this, use the
ckDoingBallMain () method to check if the animation is currently in progress.
When finished, close the Window and return to the Main method.
The following is used as the Private class. Or give me a structure.
dPoint As public, it has double type x and y variables.
iPoint Like dPoint, it has int type x and y variables.
Cast Round x and y in dPoint to make iPoint.
Save the disc arrangement. The roulette discs are determined in the order of
5,22,34, ... with less regularity, not
0,1,2, .... The class that saves it.
NumOrder.search (int), which is the number of the disk.
Payment Performs monetary processing on users and dealers.
void calcEach(Player, Player, int) Calculate by licking the place where the user bet.
void clac(Player, Player, int, AnyNumMoney) The inside bet and the outside bet are judged for the place where the user bets.
Wallet Save the player's and dealer's money.
Wallet(int) Set the amount of money you have.
int getCache() Get your money.
void Cache(int) Make a payment. The amount of the argument is deducted from the amount of money you have.
boolean isInsolvency() Returns whether it is bankrupt by T / F.
Player Classes about Players and dealers.
Dealer It just inherits Player.
. ├── ButtonIMG/ #Image file to replace the button ├── README.md └── roulette/ ├── Makefile #Build, for execution ├── bin/ #Generated.class is automatically placed └── src/ #source file ├── AnyNumMoney.java ├── Ball.java ├── Dealer.java ├── InforMation.java ├── MyColor.java ├── Number.java ├── NumbersTable.java ├── Payment.java ├── Player.java ├── Progress.java ├── Roulette.java ├── Table.java ├── Wallet.java └── WalletTest.java
git clone, move Directory with
After that, execute the following for the operation you want to perform.
Both compile and run
$ make class
$ make exe
Delete the Class file
$ make clean
Generate jar file
$ make jar
We introduced the created roulette app. I will paste the running image or sometime soon. For the time being, it is possible to play, so please play. I would be very happy if you could give me any reviews.