Skip to content

Commit

Permalink
Merge pull request #1 from PocketRice/v1
Browse files Browse the repository at this point in the history
Merge v1.0.0 commit
  • Loading branch information
pocketrice authored Jan 26, 2023
2 parents 9012a31 + 2a972d2 commit 72ce624
Show file tree
Hide file tree
Showing 168 changed files with 2,165 additions and 162 deletions.
19 changes: 13 additions & 6 deletions GD-JFX.iml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,22 @@
<orderEntry type="library" name="lib" level="project" />
<orderEntry type="library" name="jfxtras.jmetro" level="project" />
<orderEntry type="library" name="controlsfx" level="project" />
<orderEntry type="library" name="kordamp.bootstrapfx.core" level="project" />
<orderEntry type="library" name="kordamp.ikonli.core" level="project" />
<orderEntry type="library" name="dlsc.formsfx.core" level="project" />
<orderEntry type="library" name="jfree.fxgraphics2d" level="project" />
<orderEntry type="library" name="github.almasb.fxgl" level="project" />
<orderEntry type="library" name="javatuples" level="project" />
<orderEntry type="library" name="sta.soft.richtextfx" level="project" />
<orderEntry type="library" name="testfx.core" level="project" />
<orderEntry type="library" name="de.schlegel11.jfxanimation" level="project" />
<orderEntry type="library" name="apache.commons.lang3" level="project" />
<orderEntry type="library" name="eu.iamgio.animated" level="project" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/23.0.0/annotations-23.0.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="kordamp.ikonli.javafx" level="project" />
<orderEntry type="library" name="kordamp.ikonli.materialdesign.pack" level="project" />
<orderEntry type="library" name="kordamp.ikonli.materialdesign2.pack" level="project" />
</component>
</module>
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Gambler's Delight (GDJFX)
![casino](https://user-images.githubusercontent.com/79682953/214141005-cf24c024-4be7-4759-9161-91269e993b71.jpg)
_Lean green gambling machine running on the power of coffee beans and JavaFX._
# READ ME!!
To Dr. Kahle,

For the rough draft for this project, the **runner file for the console-based version of this project is... a little buried.** (sorry!)

<br><br>
#
> Execute program (app or CLI) at com.gdjfx/app/ProgramApplet or com.gdjfx/cli/ProgramConsole.
_<h3>Here's where you can find the runner file:</h3>_
* src/com.gdjfx/console/ProgramConsole.java
Binary file modified out/production/GD-JFX/com/gdjfx/Card$Rank.class
Binary file not shown.
Binary file modified out/production/GD-JFX/com/gdjfx/Card$Suit.class
Binary file not shown.
Binary file modified out/production/GD-JFX/com/gdjfx/Card.class
Binary file not shown.
Binary file modified out/production/GD-JFX/com/gdjfx/Dice.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified out/production/GD-JFX/com/gdjfx/app/ProgramApplet.class
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
105 changes: 97 additions & 8 deletions out/production/GD-JFX/com/gdjfx/app/main.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,107 @@


.button {
-fx-background-color: linear-gradient(to bottom, #BFA9926D, #BFA992AD,#BFA9926D);
-fx-background-radius: 8px;
-fx-margin: 10px;
-fx-border: 5px;
-fx-border-color: #AAAFFF;
-fx-background-color: #bcbbb3E0;
-fx-background-radius: 6px;
}

.button:hover {
-fx-background-color: #c5d7da;
-fx-background-color: #999891E0;
}

.button:active {
-fx-background-color: #b8c7ca;
.button.active {
-fx-border-radius: 4px;
-fx-border-color: #e2ab7b;
-fx-border-width: 3px;
-fx-border-style: solid;
-fx-background-color: #f2cfacE0;
}

.button.active:hover {
-fx-background-color: #ffd0a3E0;
}

.button.selected0 {
-fx-border-radius: 4px;
-fx-border-color: #efcf73;
-fx-border-width: 3px;
-fx-border-style: solid;
-fx-background-color: #ffe78dE0;
}

.button.selected1 {
-fx-background-color: #bcbbb3E0;
}

.scroll-pane {
-fx-background-color: transparent;
}

.scroll-pane > .viewport {
-fx-background-color: transparent;
}


.scroll-bar:horizontal .track,
.scroll-bar:vertical .track{
-fx-background-color : #FFFFFF;
-fx-border-color :transparent;
-fx-background-radius : 0.0em;
-fx-border-radius :2.0em;
}


.scroll-bar:horizontal .increment-button ,
.scroll-bar:horizontal .decrement-button {
-fx-background-color :transparent;
-fx-background-radius : 0.0em;
-fx-padding :0.0 0.0 10.0 0.0;

}

.scroll-bar:vertical .increment-button ,
.scroll-bar:vertical .decrement-button {
-fx-background-color :transparent;
-fx-background-radius : 0.0em;
-fx-padding :0.0 10.0 0.0 0.0;

}

.scroll-bar .increment-arrow,
.scroll-bar .decrement-arrow{
-fx-shape : " ";
-fx-padding :0.15em 0.0;
}

.scroll-bar:vertical .increment-arrow,
.scroll-bar:vertical .decrement-arrow{
-fx-shape : " ";
-fx-padding :0.0 0.15em;
}

.scroll-bar:horizontal .thumb,
.scroll-bar:vertical .thumb {
-fx-background-color :derive(black,90.0%);
-fx-background-insets : 2.0, 0.0, 0.0;
-fx-background-radius : 2.0em;
}

.scroll-bar:horizontal .thumb:hover,
.scroll-bar:vertical .thumb:hover {
-fx-background-color :derive(#4d4c4f,10.0%);
-fx-background-insets : 2.0, 0.0, 0.0;
-fx-background-radius : 2.0em;
}

#btnPause {
-fx-background-color: #958cad70 !important;
}

#btnPause .ikonli-font-icon {
-fx-icon-color: #c1b6daDD;
}

#btnStart .ikonli-font-icon {
-fx-icon-color: #4c5c5eBD;
-fx-icon-size: 70px;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
28 changes: 26 additions & 2 deletions src/com/gdjfx/Card.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.gdjfx;

import java.util.Arrays;
import java.util.stream.DoubleStream;

public class Card {
public enum Suit {
CLUB,
Expand Down Expand Up @@ -29,8 +32,8 @@ public enum Rank {
public Rank cardRank; // Use cardvalue to calculate this

public Card() { // "Get a random card" -- to actually make sure they match the confines of a real deck, use the "drawCard" method in cardDeck
cardSuit = Referee.weightedRandom(Suit.values(), new double[4], true);
cardRank = Referee.weightedRandom(Rank.values(), new double[13], true);
cardSuit = weightedRandom(Suit.values(), new double[4], true);
cardRank = weightedRandom(Rank.values(), new double[13], true);
cardValue = cardRank.ordinal() + 1;
}

Expand All @@ -39,4 +42,25 @@ public Card(Suit cs, int cv) {
cardValue = cv;
cardRank = Rank.values()[cv-1];
}

public static <T> T weightedRandom(T[] choices, double[] weights, boolean autoEqualize)
{
double rng = Math.random();

if (autoEqualize) {
Arrays.fill(weights, 1.0 / choices.length);
}

assert (DoubleStream.of(weights).sum() != 1) : "Error: weightedRandom weights do not add up to 1 (= " + DoubleStream.of(weights).sum() + ")!";
assert (choices.length == weights.length) : "Error: weightedRandom choice (" + choices.length + ") and weights (" + weights.length + ") array are not the same length!";

for (int i = 0; i < weights.length; i++) {
if (rng < weights[i])
return choices[i];
else
rng -= weights[i];
}

return null;
}
}
39 changes: 22 additions & 17 deletions src/com/gdjfx/Dice.java
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
package com.gdjfx;

import com.gdjfx.deprecated.Model;
import com.gdjfx.deprecated.ModelTexture;
import org.apache.commons.lang3.ArrayUtils;
import java.util.Arrays;
import java.util.stream.DoubleStream;

public class Dice { // todo: might need to store position of dice (rotation, location, etc.); store here or in the actual "environment"?
public int sideCount;
public int selectedValue; // Num of sides to dice (for use in rolling / 3d model generator) // calculated value of dice roll
int[] sideValues; // Values for each side. Array length must equal sideCount (asserted)
Model model;
ModelTexture[] sideTextures; // Normally the Model object would hold its own textures to parse. The Dice has add'l transparent textures for the dot thingies on each side separate from the Model's textures. Must match sideCount.

public Dice() { // Default constr.; creates a regular dice.
sideValues = new int[]{1,2,3,4,5,6};
sideCount = sideValues.length;
model = generateDiceModel();
sideTextures = null; // Just have some default textures lying around I dunno
selectedValue = -1;
}

public Dice(int[] sv, Model m, ModelTexture[] st) {
assert (sv.length == st.length) : "Error: Dice object of name " + this + " has invalid # of side values or side textures!\n# of side values: " + sv.length + "\n# of side textures: " + st.length;
public Dice(int[] sv) {
assert (Arrays.stream(sv).min().getAsInt() > 0) : "Error: Dice object of name " + this + " has invalid side values; found minimum of " + Arrays.stream(sv).min() + " is less than 0";
sideValues = sv;
sideCount = sv.length;
model = m;
sideTextures = st;
selectedValue = -1; // 2nd assertion guarantees no negatives; this allows for safely checking if selectedValue was not set yet.
}

public Model generateDiceModel() {
return new Model(); // based on side count generate a regular prism... thingy... whatever it's called
public int getTheoreticalSelectedValue() { // Based on hard, cold equal probabilities.
return weightedRandom(ArrayUtils.toObject(sideValues), new double[sideValues.length], true);
}

public int getRealSelectedValue(int[] coords, int[] rotation) {
return -1; // Based on side from dice with highest Y value (e.g. point X is highest, which lies on side Z so that side is selected).
}
public static <T> T weightedRandom(T[] choices, double[] weights, boolean autoEqualize)
{
double rng = Math.random();

public int getTheoreticalSelectedValue() { // Based on hard, cold equal probabilities.
return Referee.weightedRandom(ArrayUtils.toObject(sideValues), new double[sideValues.length], true);
if (autoEqualize) {
Arrays.fill(weights, 1.0 / choices.length);
}

assert (DoubleStream.of(weights).sum() != 1) : "Error: weightedRandom weights do not add up to 1 (= " + DoubleStream.of(weights).sum() + ")!";
assert (choices.length == weights.length) : "Error: weightedRandom choice (" + choices.length + ") and weights (" + weights.length + ") array are not the same length!";

for (int i = 0; i < weights.length; i++) {
if (rng < weights[i])
return choices[i];
else
rng -= weights[i];
}

return null;
}

public void roll() {
Expand Down
Loading

0 comments on commit 72ce624

Please sign in to comment.