diff --git a/Casino Project-Page-1.drawio (1).png b/Casino Project-Page-1.drawio (1).png
new file mode 100644
index 00000000..b8feb8da
Binary files /dev/null and b/Casino Project-Page-1.drawio (1).png differ
diff --git a/Casino Project-Page-1.drawio.png b/Casino Project-Page-1.drawio.png
new file mode 100644
index 00000000..22252087
Binary files /dev/null and b/Casino Project-Page-1.drawio.png differ
diff --git a/GroupCasino b/GroupCasino
new file mode 160000
index 00000000..d1d59124
--- /dev/null
+++ b/GroupCasino
@@ -0,0 +1 @@
+Subproject commit d1d59124c2f6d4149e6028bf2c84a2f394695de7
diff --git a/pom.xml b/pom.xml
index 8c2655d3..a3aeec7d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,8 +47,8 @@
maven-compiler-plugin
3.6.0
- ${java.version}
- ${java.version}
+ 8
+ 8
diff --git a/src/main/java/com/github/zipcodewilmington/Casino.java b/src/main/java/com/github/zipcodewilmington/Casino.java
index 5eae9ac0..99ff50da 100644
--- a/src/main/java/com/github/zipcodewilmington/Casino.java
+++ b/src/main/java/com/github/zipcodewilmington/Casino.java
@@ -4,36 +4,68 @@
import com.github.zipcodewilmington.casino.CasinoAccountManager;
import com.github.zipcodewilmington.casino.GameInterface;
import com.github.zipcodewilmington.casino.PlayerInterface;
+import com.github.zipcodewilmington.casino.games.BlackJack.BlackJackGame;
+import com.github.zipcodewilmington.casino.games.RideTheBus.RideTheBusGame;
+import com.github.zipcodewilmington.casino.games.StreetCraps;
import com.github.zipcodewilmington.casino.games.numberguess.NumberGuessGame;
import com.github.zipcodewilmington.casino.games.numberguess.NumberGuessPlayer;
import com.github.zipcodewilmington.casino.games.slots.SlotsGame;
import com.github.zipcodewilmington.casino.games.slots.SlotsPlayer;
+import com.github.zipcodewilmington.casino.games.CasinoWar.CasinoWar;
+
import com.github.zipcodewilmington.utils.AnsiColor;
import com.github.zipcodewilmington.utils.IOConsole;
/**
* Created by leon on 7/21/2020.
*/
+
public class Casino implements Runnable {
private final IOConsole console = new IOConsole(AnsiColor.BLUE);
@Override
public void run() {
+ CasinoAccountManager.addAllAccounts();
+
String arcadeDashBoardInput;
CasinoAccountManager casinoAccountManager = new CasinoAccountManager();
do {
+ CasinoAccountManager.addtofile();
arcadeDashBoardInput = getArcadeDashboardInput();
if ("select-game".equals(arcadeDashBoardInput)) {
String accountName = console.getStringInput("Enter your account name:");
String accountPassword = console.getStringInput("Enter your account password:");
+
CasinoAccount casinoAccount = casinoAccountManager.getAccount(accountName, accountPassword);
boolean isValidLogin = casinoAccount != null;
+
if (isValidLogin) {
+
String gameSelectionInput = getGameSelectionInput().toUpperCase();
if (gameSelectionInput.equals("SLOTS")) {
- play(new SlotsGame(), new SlotsPlayer());
- } else if (gameSelectionInput.equals("NUMBERGUESS")) {
- play(new NumberGuessGame(), new NumberGuessPlayer());
+ SlotsGame slots = new SlotsGame(casinoAccount);
+ try {
+ slots.run();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ } else if (gameSelectionInput.equals("RIDETHEBUS")) {
+ RideTheBusGame ride = new RideTheBusGame(casinoAccount);
+ ride.start();
+
+
+ }
+ else if (gameSelectionInput.equals("WAR")) {
+ CasinoWar casinoWar = new CasinoWar();
+ casinoWar.run();
+
+
+ } else if (gameSelectionInput.equals("STREETCRAPS")) {
+ StreetCraps craps = new StreetCraps(casinoAccount);
+ craps.run();
+ }
+ else if (gameSelectionInput.equals("BLACKJACK")) {
+ BlackJackGame.runBlackJack();
} else {
// TODO - implement better exception handling
String errorMessage = "[ %s ] is an invalid game selection";
@@ -49,9 +81,11 @@ public void run() {
String accountName = console.getStringInput("Enter your account name:");
String accountPassword = console.getStringInput("Enter your account password:");
CasinoAccount newAccount = casinoAccountManager.createAccount(accountName, accountPassword);
- casinoAccountManager.registerAccount(newAccount);
+ CasinoAccountManager.addtofile();
+ //casinoAccountManager.registerAccount(newAccount);
}
} while (!"logout".equals(arcadeDashBoardInput));
+
}
private String getArcadeDashboardInput() {
@@ -66,14 +100,15 @@ private String getGameSelectionInput() {
return console.getStringInput(new StringBuilder()
.append("Welcome to the Game Selection Dashboard!")
.append("\nFrom here, you can select any of the following options:")
- .append("\n\t[ SLOTS ], [ NUMBERGUESS ]")
+ .append("\n\t[ SLOTS ], [ RIDETHEBUS ], [ WAR ], [ STREETCRAPS ], [ BLACKJACK ] ")
.toString());
}
- private void play(Object gameObject, Object playerObject) {
- GameInterface game = (GameInterface)gameObject;
- PlayerInterface player = (PlayerInterface)playerObject;
+ private void play(Object gameObject, Object playerObject) throws InterruptedException {
+ GameInterface game = (GameInterface) gameObject;
+ PlayerInterface player = (PlayerInterface) playerObject;
game.add(player);
game.run();
- }
-}
+
+ }}
+
diff --git a/src/main/java/com/github/zipcodewilmington/MainApplication.java b/src/main/java/com/github/zipcodewilmington/MainApplication.java
index 508787a8..3d957d47 100644
--- a/src/main/java/com/github/zipcodewilmington/MainApplication.java
+++ b/src/main/java/com/github/zipcodewilmington/MainApplication.java
@@ -1,7 +1,12 @@
package com.github.zipcodewilmington;
-public class MainApplication {
- public static void main(String[] args) {
+public class MainApplication
+{
+ public static void main(String[] args) throws InterruptedException
+ {
new Casino().run();
}
}
+
+
+
diff --git a/src/main/java/com/github/zipcodewilmington/casino/Accounts.txt b/src/main/java/com/github/zipcodewilmington/casino/Accounts.txt
new file mode 100644
index 00000000..88303ed3
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/Accounts.txt
@@ -0,0 +1,7 @@
+Santos,Santos,123,100.0
+Kantos,Kantos,ugh,1450.0
+BobLee,BobLee,4321,0.0
+hans,hans,4321,0.0
+bans,bans,4321,0.0
+Deep,Deep,rollinginthedeep,0.0
+1,1,1,1046.0
diff --git a/src/main/java/com/github/zipcodewilmington/casino/CasinoAccount.java b/src/main/java/com/github/zipcodewilmington/casino/CasinoAccount.java
index 654c749b..b2fbf98d 100644
--- a/src/main/java/com/github/zipcodewilmington/casino/CasinoAccount.java
+++ b/src/main/java/com/github/zipcodewilmington/casino/CasinoAccount.java
@@ -6,4 +6,57 @@
* The `ArcadeAccount` is used to log into the system to select a `Game` to play.
*/
public class CasinoAccount {
+ // variables
+ private String accountName;
+ private String accountPassword;
+ private double casinoBalance = 0;
+
+ public CasinoAccount(String accountName, String accountPassword) {
+ this.accountName = accountName;
+ this.accountPassword = accountPassword;
+ }
+
+ public CasinoAccount() {
+
+ }
+
+ public String getName() {
+ return accountName;
+ }
+
+ public void setAccountName(String accountName) {
+ this.accountName = accountName;
+ }
+
+ public String getAccountPassword() {
+ return accountPassword;
+ }
+
+ public void setAccountPassword(String accountPassword) {
+ this.accountPassword = accountPassword;
+ }
+
+ public double getCasinoBalance() {
+ return casinoBalance;
+ }
+ public void addCasinoBalance(double add){
+ casinoBalance+=add;
+ }
+ public void subCasinoBalance(double sub){
+ casinoBalance-=sub;
+ }
+
+
+ public void setCasinoBalance(double casinoBalance) {
+ this.casinoBalance = casinoBalance;
+ }
+
+
+ public CasinoAccount(String accountName, String accountPassword, double casinoBalance) {
+ this.accountName = accountName;
+ this.accountPassword = accountPassword;
+ this.casinoBalance=casinoBalance;
+ }
+
+
}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/CasinoAccountManager.java b/src/main/java/com/github/zipcodewilmington/casino/CasinoAccountManager.java
index 2d09ec2a..e324ed75 100644
--- a/src/main/java/com/github/zipcodewilmington/casino/CasinoAccountManager.java
+++ b/src/main/java/com/github/zipcodewilmington/casino/CasinoAccountManager.java
@@ -1,23 +1,55 @@
package com.github.zipcodewilmington.casino;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.*;
+
/**
* Created by leon on 7/21/2020.
* `ArcadeAccountManager` stores, manages, and retrieves `ArcadeAccount` objects
* it is advised that every instruction in this class is logged
*/
-public class CasinoAccountManager {
+public class CasinoAccountManager extends CasinoAccount{
/**
* @param accountName name of account to be returned
* @param accountPassword password of account to be returned
* @return `ArcadeAccount` with specified `accountName` and `accountPassword`
*/
+
+ public static LinkedHashMap data = new LinkedHashMap();
+
+
public CasinoAccount getAccount(String accountName, String accountPassword) {
- String currentMethodName = new Object(){}.getClass().getEnclosingMethod().getName();
- String currentClassName = getClass().getName();
- String errorMessage = "Method with name [ %s ], defined in class with name [ %s ] has not yet been implemented";
- throw new RuntimeException(String.format(errorMessage, currentMethodName, currentClassName));
+
+ boolean end=false;
+ Iterator it = data.entrySet().iterator();
+ CasinoAccount acc = null;
+ // acc=data.get(accountName);
+
+ while (it.hasNext()&& !end) {
+ Map.Entry pair = (Map.Entry) it.next();
+ acc = (CasinoAccount) pair.getValue();
+ if (Objects.equals(acc.getName(), accountName) && Objects.equals(acc.getAccountPassword(), accountPassword)) {
+ end = true;
+ }
+ else{
+ acc=null;
+ }
+ }
+
+ return acc;
}
+
+ //String currentMethodName = new Object(){}.getClass().getEnclosingMethod().getName();
+ //String currentClassName = getClass().getName();
+ //String errorMessage = "Method with name [ %s ], defined in class with name [ %s ] has not yet been implemented";
+ //throw new RuntimeException(String.format(errorMessage, currentMethodName, currentClassName));
+
+
+
/**
* logs & creates a new `ArcadeAccount`
*
@@ -25,11 +57,21 @@ public CasinoAccount getAccount(String accountName, String accountPassword) {
* @param accountPassword password of account to be created
* @return new instance of `ArcadeAccount` with specified `accountName` and `accountPassword`
*/
+
public CasinoAccount createAccount(String accountName, String accountPassword) {
+ CasinoAccount account=new CasinoAccount();
+
+
+
String currentMethodName = new Object(){}.getClass().getEnclosingMethod().getName();
+ account.setAccountName(accountName);
String currentClassName = getClass().getName();
+ account.setAccountPassword(accountPassword);
String errorMessage = "Method with name [ %s ], defined in class with name [ %s ] has not yet been implemented";
- throw new RuntimeException(String.format(errorMessage, currentMethodName, currentClassName));
+ data.put(accountName,account);
+ return account;
+
+
}
/**
@@ -37,10 +79,73 @@ public CasinoAccount createAccount(String accountName, String accountPassword) {
*
* @param casinoAccount the arcadeAccount to be added to `this.getArcadeAccountList()`
*/
+
public void registerAccount(CasinoAccount casinoAccount) {
+
+
String currentMethodName = new Object(){}.getClass().getEnclosingMethod().getName();
+
String currentClassName = getClass().getName();
+
String errorMessage = "Method with name [ %s ], defined in class with name [ %s ] has not yet been implemented";
throw new RuntimeException(String.format(errorMessage, currentMethodName, currentClassName));
}
+ public static void addAllAccounts(){
+ data.put("Santos",new CasinoAccount("Santos","123" , 1000));
+
+
+
+ try {
+ Scanner fileIn = new Scanner(new File("src/main/java/com/github/zipcodewilmington/casino/Accounts.txt"));
+
+ while (fileIn.hasNextLine())
+ {
+ String line = fileIn.nextLine();
+ String [] accountData=line.split(",");
+ String hashKey= (accountData[0]);
+ String accountName= (accountData[1]);
+ String accountPass= (accountData[2]);
+ double casinoBalance= Double.parseDouble(accountData[3]);
+
+ // Reads the entire line
+ // Output the line
+ data.put(hashKey, new CasinoAccount(accountName,accountPass,casinoBalance));
+ }
+ }
+ catch (IOException e) {
+ System.out.println("File not found");
+ }
+ }
+ public static void addtofile(){
+ //add to file
+ File file = new File("src/main/java/com/github/zipcodewilmington/casino/Accounts.txt");
+ BufferedWriter bf = null;
+ //adds account to properties
+ try {
+
+
+ bf = new BufferedWriter(new FileWriter(file));
+ for (Map.Entry entry : data.entrySet()) {
+ // put key and value separated by a colon
+ bf.write(entry.getKey() + "," + entry.getValue().getName()+","+entry.getValue().getAccountPassword()+","+entry.getValue().getCasinoBalance());
+ // new line
+ bf.newLine();
+ }
+ bf.flush();
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ finally {
+
+ try {
+
+ // always close the writer
+ bf.close();
+ }
+ catch (Exception e) {
+ }
+ }
+
+ }
}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/GameInterface.java b/src/main/java/com/github/zipcodewilmington/casino/GameInterface.java
index 9873f1ed..7b58207a 100644
--- a/src/main/java/com/github/zipcodewilmington/casino/GameInterface.java
+++ b/src/main/java/com/github/zipcodewilmington/casino/GameInterface.java
@@ -16,8 +16,9 @@ public interface GameInterface extends Runnable {
*/
void remove(PlayerInterface player);
+
+
/**
* specifies how the game will run
*/
- void run();
}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackCard.java b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackCard.java
new file mode 100644
index 00000000..b7cb34f4
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackCard.java
@@ -0,0 +1,54 @@
+package com.github.zipcodewilmington.casino.games.BlackJack;
+
+public class BlackJackCard implements Comparable{
+
+ private BlackJackSuit blackJackSuit;
+ private BlackJackRankEnum blackJackRankEnum;
+
+
+ public BlackJackCard(BlackJackSuit blackJackSuit, BlackJackRankEnum blackJackRankEnum){
+ this.blackJackSuit = blackJackSuit;
+ this.blackJackRankEnum = blackJackRankEnum;
+ }
+
+
+ public BlackJackCard(BlackJackCard blackJackCard){
+ this.blackJackSuit = blackJackCard.getSuit();
+ this.blackJackRankEnum = blackJackCard.getRank();
+ }
+
+
+ public int getValue(){
+ return blackJackRankEnum.rankValue;
+ }
+
+
+ public BlackJackSuit getSuit(){
+ return blackJackSuit;
+ }
+
+ public BlackJackRankEnum getRank(){
+ return blackJackRankEnum;
+ }
+
+
+ public String toString(){
+ return ("["+ blackJackRankEnum +" of "+ blackJackSuit + "] ("+this.getValue()+")");
+
+ }
+
+
+ @Override
+ public int compareTo(BlackJackCard c) {
+ //if this card is greater than the other card
+ if(this.getValue() > c.getValue()){
+ return 1;
+ }
+ else if(this.getValue() < c.getValue()){
+ return -1;
+ }
+ else{
+ return 0;
+ }
+ }
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackDealer.java b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackDealer.java
new file mode 100644
index 00000000..5b2ecf5e
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackDealer.java
@@ -0,0 +1,22 @@
+package com.github.zipcodewilmington.casino.games.BlackJack;
+
+public class BlackJackDealer extends BlackJackPerson {
+
+
+ public BlackJackDealer(){
+
+ //Name the dealer "Dealer"
+ super.setName("Dealer");
+
+ }
+
+
+ public void printFirstHand(){
+ System.out.println("The dealer's hand looks like this:");
+ System.out.println(super.getHand().getCard(0));
+ System.out.println("The second card is face down.");
+ }
+
+
+
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackDeck.java b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackDeck.java
new file mode 100644
index 00000000..d5754003
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackDeck.java
@@ -0,0 +1,112 @@
+package com.github.zipcodewilmington.casino.games.BlackJack;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Random;
+
+
+public class BlackJackDeck {
+
+ public ArrayList getDeck() {
+ return deck;
+ }
+
+ //An arraylist to hold the deck of Cards
+ private ArrayList deck;
+
+
+
+ public BlackJackDeck(){
+ deck = new ArrayList();
+ }
+
+
+ public BlackJackDeck(BlackJackDeck c){
+ Collections.copy(this.deck, c.getCards());
+ }
+
+
+ public BlackJackDeck(boolean makeDeck){
+ deck = new ArrayList();
+ if(makeDeck){
+ //Go through all the suits
+ for(BlackJackSuit blackJackSuit : BlackJackSuit.values()){
+ //Go through all the ranks
+ for(BlackJackRankEnum blackJackRankEnum : BlackJackRankEnum.values()){
+ //add a new card containing each iterations suit and rank
+ deck.add(new BlackJackCard(blackJackSuit, blackJackRankEnum));
+ }
+ }
+ }
+ }
+
+
+ public void addCard(BlackJackCard blackJackCard){
+ deck.add(blackJackCard);
+ }
+
+
+ public void addCards(ArrayList blackJackCards){
+ deck.addAll(blackJackCards);
+ }
+
+ public String toString(){
+ //A string to hold everything we're going to return
+ String output = "";
+
+ for(BlackJackCard blackJackCard : deck){
+ output += blackJackCard;
+ output += "\n";
+ }
+ return output;
+ }
+
+ public void shuffle(){
+ Collections.shuffle(deck, new Random());
+ }
+
+
+ public BlackJackCard takeCard(){
+
+ //Take a copy of the first card from the deck
+ BlackJackCard blackJackCardToTake = new BlackJackCard(deck.get(0));
+ //Remove the card from the deck
+ deck.remove(0);
+ //Give the card back
+ return blackJackCardToTake;
+
+ }
+
+ public boolean hasCards(){
+ if (deck.size()>0){
+ return true;
+ }
+ else{
+ return false;
+ }
+ }
+
+
+ public int cardsLeft(){
+ return deck.size();
+ }
+
+
+ public ArrayList getCards() {
+ return deck;
+ }
+
+
+ public void emptyDeck(){
+ deck.clear();
+ }
+
+ public void reloadDeckFromDiscard(BlackJackDeck discard){
+ this.addCards(discard.getCards());
+ this.shuffle();
+ discard.emptyDeck();
+ System.out.println("Ran out of cards, creating new deck from discard pile & shuffling deck.");
+ }
+
+
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackGame.java b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackGame.java
new file mode 100644
index 00000000..906cbca6
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackGame.java
@@ -0,0 +1,154 @@
+package com.github.zipcodewilmington.casino.games.BlackJack;
+
+
+public class BlackJackGame {
+
+ //Declare variables needed for Game class
+ private BlackJackDeck blackJackDeck, discarded;
+
+ private BlackJackDealer blackJackDealer;
+
+ public BlackJackPlayer getPlayer() {
+ return blackJackPlayer;
+ }
+
+ private BlackJackPlayer blackJackPlayer;
+ private int wins, losses, pushes;
+
+
+
+
+ public BlackJackGame(){
+
+ //Create a new deck with 52 cards
+ blackJackDeck = new BlackJackDeck(true);
+ //Create a new empty deck
+ discarded = new BlackJackDeck();
+
+ //Create the People
+ blackJackDealer = new BlackJackDealer();
+ blackJackPlayer = new BlackJackPlayer();
+
+
+ //Shuffle the deck and start the first round
+ blackJackDeck.shuffle();
+ startRound();
+ }
+
+ private void startRound(){
+/* wins = 0; losses = 0; pushes = 1;
+ Card testCard = new Card(Suit.CLUB,Rank.NINE);
+ Card testCard2 = new Card(Suit.CLUB, Rank.TEN);*/
+ //If this isn't the first time, display the users score and put their cards back in the deck
+ if(wins>0 || losses>0 || pushes > 0){
+
+ System.out.println();
+ System.out.println("Starting Next Round... Wins: " + wins + " Losses: "+ losses+ " Pushes: "+pushes);
+ blackJackDealer.getHand().discardHandToDeck(discarded);
+ blackJackPlayer.getHand().discardHandToDeck(discarded);
+ }
+
+ //Check to make sure the deck has at least 4 cards left
+ if(blackJackDeck.cardsLeft() < 4){
+ blackJackDeck.reloadDeckFromDiscard(discarded);
+ }
+
+ //Give the dealer two cards
+ blackJackDealer.getHand().takeCardFromDeck(blackJackDeck);
+ blackJackDealer.getHand().takeCardFromDeck(blackJackDeck);
+
+ //Give the player two cards
+ blackJackPlayer.getHand().takeCardFromDeck(blackJackDeck);
+ blackJackPlayer.getHand().takeCardFromDeck(blackJackDeck);
+
+/* //TEST
+ player.getHand().addCard(testCard);
+ player.getHand().addCard(testCard2);*/
+
+ //Show the dealers hand with one card face down
+ blackJackDealer.printFirstHand();
+
+ //Show the player's hand
+ blackJackPlayer.printHand();
+
+ //Check if dealer has BlackJack to start
+ if(blackJackDealer.hasBlackjack()){
+ //Show the dealer has BlackJack
+ blackJackDealer.printHand();
+
+ //Check if the player also has BlackJack
+ if(blackJackPlayer.hasBlackjack()){
+ //End the round with a push
+ System.out.println("You both have 21 - Push.");
+ pushes++;
+ startRound();
+ }
+ else{
+ System.out.println("Dealer has BlackJack. You lose.");
+ blackJackDealer.printHand();
+ losses++;
+ startRound();
+ }
+ }
+
+ //Check if player has blackjack to start
+ //If we got to this point, we already know the dealer didn't have blackjack
+ if(blackJackPlayer.hasBlackjack()){
+ System.out.println("You have Blackjack! You win!");
+ wins++;
+ startRound();
+ }
+
+ //Let the player decide what to do next
+ blackJackPlayer.makeDecision(blackJackDeck, discarded);
+
+ //Check if they busted
+ if(blackJackPlayer.getHand().calculatedValue() > 21){
+ System.out.println("You have gone over 21.");
+ losses ++;
+ startRound();
+ }
+
+ //Now it's the dealer's turn
+ blackJackDealer.printHand();
+ while(blackJackDealer.getHand().calculatedValue()<17){
+ blackJackDealer.hit(blackJackDeck, discarded);
+ }
+
+ //Check who wins
+ if(blackJackDealer.getHand().calculatedValue()>21){
+ System.out.println("Dealer busts");
+ wins++;
+ }
+ else if(blackJackDealer.getHand().calculatedValue() > blackJackPlayer.getHand().calculatedValue()){
+ System.out.println("You lose.");
+ losses++;
+ }
+ else if(blackJackPlayer.getHand().calculatedValue() > blackJackDealer.getHand().calculatedValue()){
+ System.out.println("You win.");
+ wins++;
+ }
+ else{
+ System.out.println("Push.");
+ }
+
+ //Start a new round
+ startRound();
+ }
+
+
+public static void pause(){
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+}
+ public static void runBlackJack(){
+ System.out.println("Welcome to BlackJack.");
+
+ BlackJackGame blackjack = new BlackJackGame();
+ }
+
+
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackHand.java b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackHand.java
new file mode 100644
index 00000000..83959797
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackHand.java
@@ -0,0 +1,76 @@
+package com.github.zipcodewilmington.casino.games.BlackJack;
+
+import java.util.ArrayList;
+
+/**
+ * A hand of cards to play with
+ */
+public class BlackJackHand {
+
+ private ArrayList hand;
+
+ public BlackJackHand(){
+ hand = new ArrayList();
+ }
+
+ public void takeCardFromDeck(BlackJackDeck blackJackDeck){
+ hand.add(blackJackDeck.takeCard());
+ }
+
+
+ public void discardHandToDeck(BlackJackDeck discardBlackJackDeck){
+
+ //copy cards from hand to discardDeck
+ discardBlackJackDeck.addCards(hand);
+
+ //clear the hand
+ hand.clear();
+
+ }
+
+
+ public String toString(){
+ String output = "";
+ for(BlackJackCard blackJackCard : hand){
+ output += blackJackCard + " - ";
+ }
+ return output;
+ }
+
+
+
+ public int calculatedValue(){
+
+ //variable to count number of aces, and current total value
+ int value = 0;
+ int aceCount = 0;
+
+ //For each card in this hand
+ for(BlackJackCard blackJackCard : hand){
+ //Add the card value to the hand
+ value += blackJackCard.getValue();
+ //Count how many aces have been added
+ if (blackJackCard.getValue() == 11){
+ aceCount ++;
+ }
+ }
+ //if we have a scenario where we have multiple aces, as may be the case of drawing 10, followed by two or more aces, (10+11+1 > 21)
+ //go back and set each ace to 1 until get back under 21, if possible
+ if (value > 21 && aceCount > 0){
+ while(aceCount > 0 && value > 21){
+ aceCount --;
+ value -= 10;
+ }
+ }
+ return value;
+
+ }
+
+
+ public BlackJackCard getCard(int idx){
+ return hand.get(idx);
+ }
+
+
+
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackPerson.java b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackPerson.java
new file mode 100644
index 00000000..3e6b4a41
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackPerson.java
@@ -0,0 +1,61 @@
+package com.github.zipcodewilmington.casino.games.BlackJack;
+
+
+public abstract class BlackJackPerson {
+
+ private BlackJackHand blackJackHand;
+ private String name;
+
+ public BlackJackPerson(){
+ this.blackJackHand = new BlackJackHand();
+ this.name = "";
+ }
+
+
+ //Setters and Getters
+ public BlackJackHand getHand(){
+ return this.blackJackHand;
+ }
+ public void setHand(BlackJackHand blackJackHand){
+ this.blackJackHand = blackJackHand;
+ }
+ public String getName(){
+ return this.name;
+ }
+ public void setName(String name){
+ this.name = name;
+ }
+
+
+
+ public void printHand(){
+ System.out.println(this.name + "'s hand looks like this:");
+ System.out.println(this.blackJackHand + " Valued at: " + this.blackJackHand.calculatedValue());
+ }
+
+
+ public void hit(BlackJackDeck blackJackDeck, BlackJackDeck discard){
+
+ //If there's no cards left in the deck
+ if (!blackJackDeck.hasCards()) {
+ blackJackDeck.reloadDeckFromDiscard(discard);
+ }
+ this.blackJackHand.takeCardFromDeck(blackJackDeck);
+ System.out.println(this.name + " gets a card");
+ this.printHand();
+ BlackJackGame.pause();
+
+ }
+
+ public boolean hasBlackjack(){
+ if(this.getHand().calculatedValue() == 21){
+ return true;
+ }
+ else{
+ return false;
+ }
+ }
+
+
+
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackPlayer.java b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackPlayer.java
new file mode 100644
index 00000000..211f3d14
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackPlayer.java
@@ -0,0 +1,55 @@
+package com.github.zipcodewilmington.casino.games.BlackJack;
+
+import java.util.Scanner;
+
+
+public class BlackJackPlayer extends BlackJackPerson {
+
+ Scanner input = new Scanner(System.in);
+
+ //Create a new Player
+ public BlackJackPlayer() {
+ super.setName("Player");
+
+ }
+
+ //Allow the player to make decisions
+ public void makeDecision(BlackJackDeck blackJackDeck, BlackJackDeck discard) {
+
+ int decision = 0;
+ boolean getNum = true;
+
+ while(getNum){
+
+ try{
+ System.out.println("Would you like to: 1) Hit or 2) Stand");
+ decision = input.nextInt();
+ getNum = false;
+
+ }
+ catch(Exception e){
+ System.out.println("Invalid");
+ input.next();
+ }
+ //we don't close the scanner, because we will need it later.
+ }
+
+ if (decision == 1) {
+ this.hit(blackJackDeck, discard);
+ //return if they have blackjack or busted
+ if(this.getHand().calculatedValue()>20){
+ return;
+ }
+ else{
+ this.makeDecision(blackJackDeck, discard);
+ }
+
+ } else {
+ System.out.println("You stand.");
+ }
+
+
+ }
+
+
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackRankEnum.java b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackRankEnum.java
new file mode 100644
index 00000000..0277cb46
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackRankEnum.java
@@ -0,0 +1,30 @@
+package com.github.zipcodewilmington.casino.games.BlackJack;
+
+
+public enum BlackJackRankEnum {
+ ACE("Ace", 11),
+ TWO("Two", 2),
+ THREE("Three", 3),
+ FOUR("Four",4),
+ FIVE("Five",5),
+ SIX("Six",6),
+ SEVEN("Seven",7),
+ EIGHT("Eight",8),
+ NINE("Nine",9),
+ TEN("Ten",10),
+ JACK("Jack",10),
+ QUEEN("Queen",10),
+ KING("King",10);
+
+ String rankName;
+ int rankValue;
+
+ BlackJackRankEnum(String rankName, int rankValue){
+ this.rankName = rankName;
+ this.rankValue = rankValue;
+ }
+
+ public String toString(){
+ return rankName;
+ }
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackSuit.java b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackSuit.java
new file mode 100644
index 00000000..6ebef3bc
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJackSuit.java
@@ -0,0 +1,19 @@
+package com.github.zipcodewilmington.casino.games.BlackJack;
+
+
+public enum BlackJackSuit {
+ CLUB("Clubs"),
+ DIAMOND("Diamonds"),
+ HEART("Hearts"),
+ SPADE("Spades");
+
+ String suitName;
+
+ BlackJackSuit(String suitName) {
+ this.suitName = suitName;
+ }
+
+ public String toString(){
+ return suitName;
+ }
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/Card.java b/src/main/java/com/github/zipcodewilmington/casino/games/Card.java
new file mode 100644
index 00000000..af7e4de9
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/Card.java
@@ -0,0 +1,44 @@
+package com.github.zipcodewilmington.casino.games;
+
+public class Card {
+ String face;
+ public int value;
+ public String color;
+ public String suit;
+
+ public Card(String face, int value, String Color, String suit)
+ {
+ this.face = face;
+ this.value = value;
+ this.color = Color;
+ this.suit = suit;
+ }
+
+
+ @Override
+ public String toString() {
+ String ret ="";
+ if(value==11)
+ {
+ ret ="Jack of "+ suit;
+ }
+ else if (value==12)
+ {
+ ret ="Queen of "+ suit;
+ }
+ else if(value==13)
+ {
+ ret ="King of "+suit;
+ }
+ else if(value==14)
+ {
+ ret = "Ace of "+suit;
+ }
+ else
+ {
+ ret = value + " of " + suit;
+ }
+ return ret;
+
+ }
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/CasinoWar/CasinoWar.java b/src/main/java/com/github/zipcodewilmington/casino/games/CasinoWar/CasinoWar.java
new file mode 100644
index 00000000..b664abaa
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/CasinoWar/CasinoWar.java
@@ -0,0 +1,157 @@
+package com.github.zipcodewilmington.casino.games.CasinoWar;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Scanner;
+
+public class CasinoWar {
+
+ private List deck;
+ private int playerScore;
+ private int dealerScore;
+
+ public CasinoWar() {
+ deck = createShuffledDeck();
+ playerScore = 0;
+ dealerScore = 0;
+ }
+
+ public void playersTurn() {
+ // Player's turn
+ System.out.println("Press Enter to draw a card.");
+ new Scanner(System.in).nextLine();
+ String playerCard = drawCard();
+ System.out.println("You drew: " + playerCard);
+ dealersTurn(playerCard);
+ }
+
+ public void dealersTurn(String playerCard) {
+ // Dealer's turn
+ System.out.println("Press Enter for the dealer to draw a card.");
+ new Scanner(System.in).nextLine();
+ String dealerCard = drawCard();
+ System.out.println("Dealer drew: " + dealerCard + "\n");
+ compareCards(playerCard, dealerCard);
+ }
+
+ public void compareCards(String playerCard, String dealerCard) {
+ // Compare the cards
+ int playerValue = getCardValue(playerCard);
+ int dealerValue = getCardValue(dealerCard);
+
+ if (playerValue > dealerValue) {
+ System.out.println("You win this round!");
+ playerScore++;
+ } else if (dealerValue > playerValue) {
+ System.out.println("Dealer wins this round!");
+ dealerScore++;
+ } else {
+ System.out.println("It's a tie! Time for war!");
+ // War: draw three more cards each
+ List playerWarCards = new ArrayList<>();
+ List dealerWarCards = new ArrayList<>();
+
+ for (int i = 0; i < 3; i++) {
+ playerWarCards.add(drawCard());
+ dealerWarCards.add(drawCard());
+ }
+ startWar(playerWarCards, dealerWarCards);
+ }
+ }
+
+ public void startWar(List playerWarCards, List dealerWarCards) {
+ // Get the fourth card for comparison
+ String playerFourthCard = playerWarCards.get(0);
+ String dealerFourthCard = dealerWarCards.get(0);
+
+ System.out.println("Your fourth card: " + playerFourthCard);
+ System.out.println("Dealer's fourth card: " + dealerFourthCard);
+
+ int playerFourthCardValue = getCardValue(playerFourthCard);
+ int dealerFourthCardValue = getCardValue(dealerFourthCard);
+
+ if (playerFourthCardValue > dealerFourthCardValue) {
+ System.out.println("You win the war!");
+ playerScore++;
+ } else if (dealerFourthCardValue > playerFourthCardValue) {
+ System.out.println("Dealer wins the war!");
+ dealerScore++;
+ } else {
+ System.out.println("It's a tie in the war too! Nobody wins.");
+ }
+ }
+
+ public void displayScore() {
+ // Display the current scores
+ System.out.println("Your score: " + playerScore);
+ System.out.println("Dealer's score: " + dealerScore);
+ // Check if the deck is empty
+ if (deck.isEmpty()) {
+ System.out.println("The deck is empty. Game over!");
+ }
+ }
+
+ private List createShuffledDeck() {
+ List deck = new ArrayList<>();
+
+ String[] suits = {"Hearts", "Diamonds", "Clubs", "Spades"};
+ String[] ranks = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace"};
+
+ for (String suit : suits) {
+ for (String rank : ranks) {
+ deck.add(rank + " of " + suit);
+ }
+ }
+
+ Collections.shuffle(deck);
+ return deck;
+ }
+
+ private String drawCard() {
+ return deck.remove(deck.size() - 1);
+ }
+
+ private int getCardValue(String card) {
+ String rank = card.split(" ")[0];
+ switch (rank) {
+ case "Ace":
+ return 14;
+ case "King":
+ return 13;
+ case "Queen":
+ return 12;
+ case "Jack":
+ return 11;
+ default:
+ return Integer.parseInt(rank);
+ }
+ }
+
+
+
+ public void run(){
+ while (!this.deck.isEmpty()) {
+ this.playersTurn();
+ this.displayScore();
+ }
+ }
+
+ public int getPlayerScore() {
+ return playerScore;
+ }
+
+
+ public int getDealerScore() {
+ return dealerScore;
+ }
+
+ public boolean isGameOver() {
+ return false;
+ }
+
+}
+
+
+
+
+
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/CasinoWar/CasinoWarPlayer.java b/src/main/java/com/github/zipcodewilmington/casino/games/CasinoWar/CasinoWarPlayer.java
new file mode 100644
index 00000000..aec37970
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/CasinoWar/CasinoWarPlayer.java
@@ -0,0 +1,19 @@
+package com.github.zipcodewilmington.casino.games.CasinoWar;
+
+import java.util.Scanner;
+
+public class CasinoWarPlayer {
+
+ int playerCardValue;
+ int dealerCardValue;
+
+
+ public static int PlayersTurn(){
+ return 0;
+
+ }
+
+ public static void DealersTurn(){
+
+ }
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/Deck.java b/src/main/java/com/github/zipcodewilmington/casino/games/Deck.java
new file mode 100644
index 00000000..1ecd840c
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/Deck.java
@@ -0,0 +1,40 @@
+package com.github.zipcodewilmington.casino.games;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+public class Deck {
+
+ String[] faces = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};
+ int[] values = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
+ String[] colors = {"Red", "Black"};
+ String[] suits = {"Hearts", "Diamonds", "Clubs", "Spades"};
+ Random rand = new Random();
+ public ArrayList getDeck() {
+ return deck;
+ }
+
+ ArrayList deck = new ArrayList();
+
+ public Deck()
+ {
+ for (String suit : suits)
+ {
+ for (int i = 0; i < faces.length; i++)
+ {
+ String color = (suit.equals("Hearts") || suit.equals("Diamonds")) ? "Red" : "Black";
+ Card card = new Card(faces[i], values[i], color, suit);
+ deck.add(card);
+ }
+
+ }
+ }
+
+ public Card GetRandomCard()
+ {
+ int i = rand.nextInt(deck.size());
+ return deck.get(i);
+ }
+
+
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/DiceRoll.java b/src/main/java/com/github/zipcodewilmington/casino/games/DiceRoll.java
new file mode 100644
index 00000000..952a928c
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/DiceRoll.java
@@ -0,0 +1,44 @@
+package com.github.zipcodewilmington.casino.games;
+
+import java.util.ArrayList;
+import java.util.Random;
+
+public class DiceRoll {
+ private static int tosses;
+
+ public static final ArrayList rollResultsDice=new ArrayList<>();
+
+
+ public static void GetDiceRoll(int numberOfTosses) {
+ DiceRoll.tosses=numberOfTosses;
+
+ }
+//Create a Simulation class whose Constructor takes arguments: numberOfDies to throw numberOfTosses to run
+//
+//Create a simulation where two dies are thrown one million times. Keep track of all results.
+
+
+ public static int runSimulation() {
+ Random rd = new Random();
+
+
+ int diceRoll;
+ int sumOfRoll=0;
+
+ int max=12;
+ int min=1;
+
+ for (int i = 0; i < tosses; i++) {
+ diceRoll= rd.nextInt(max - min + 1) + min;
+ sumOfRoll += diceRoll;
+ }
+ rollResultsDice.add(sumOfRoll);
+ System.out.println(sumOfRoll);
+ return sumOfRoll;
+
+ }
+ public static ArrayList results()
+ {
+ return rollResultsDice;
+ }
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/RideTheBus/RideTheBusGame.java b/src/main/java/com/github/zipcodewilmington/casino/games/RideTheBus/RideTheBusGame.java
new file mode 100644
index 00000000..923bdcc2
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/RideTheBus/RideTheBusGame.java
@@ -0,0 +1,281 @@
+package com.github.zipcodewilmington.casino.games.RideTheBus;
+
+import com.github.zipcodewilmington.Casino;
+import com.github.zipcodewilmington.casino.CasinoAccount;
+import com.github.zipcodewilmington.casino.GameInterface;
+import com.github.zipcodewilmington.casino.PlayerInterface;
+import com.github.zipcodewilmington.casino.games.Card;
+import com.github.zipcodewilmington.casino.games.Deck;
+import com.github.zipcodewilmington.utils.AnsiColor;
+import com.github.zipcodewilmington.utils.IOConsole;
+
+import java.util.Scanner;
+
+public class RideTheBusGame implements GameInterface {
+ public RideTheBusPlayer getRider() {
+ return rider;
+ }
+ private IOConsole colorConsoleRed = new IOConsole(AnsiColor.RED);
+ IOConsole colorConsoleGreen = new IOConsole(AnsiColor.GREEN);
+ RideTheBusPlayer rider;
+ CasinoAccount retr;
+ Deck deckobj = new Deck();
+ Card[] table = new Card[4];
+ int index0;
+ Scanner scan = new Scanner(System.in);
+
+public RideTheBusGame(CasinoAccount person)
+{
+ retr = person;
+}
+
+
+ public void hop() {
+ index0 = index0 + 1;
+
+
+
+ }
+
+ public void back() {
+ index0 = index0 - 1;
+
+ }
+
+ public void deal() {
+
+ for (int i = 0; i < 4; i++) {
+ table[i] = deckobj.GetRandomCard();
+ }
+ }
+
+
+ public void HalfBet() {
+ }
+
+ public String getValue() {
+ return table[index0].toString();
+ }
+
+
+ public void reset() {
+ }
+
+ public void exitGame() {
+ }
+
+ public void start() {
+
+ rider = new RideTheBusPlayer(retr);
+ WelcomeMessage();
+ while (!checkbet(getBet()))
+ {}
+ deal();
+ while (index0 < 4)
+ {
+ gameflow();
+ status();
+ }
+ win();
+ }
+
+ public void win() {
+ if (rider.getCurrentBet() == 0) {
+ System.out.println("Congratulations on making it to the end of the bus");
+ System.out.println("Unfortunately, you have lost your entire bet.");
+ System.out.println("Better luck next time!");
+ }
+ else
+ {
+ System.out.println("Congratulations on making it to the end of the bus!");
+ int winnings = (int) (rider.getCurrentBet()*2);
+ System.out.println("Your returns are: " + winnings);
+ rider.setWallet(rider.getWallet()+winnings);
+ retr.setCasinoBalance(rider.getWallet());
+ }
+ }
+
+ public String guessHiLow() {
+ System.out.println("Do you believe the next card turned will be higher or lower?");
+ String ret = scan.nextLine().toLowerCase();
+ if(ret.equals("higher") || ret.equals("lower"))
+ {
+ return ret;
+ }
+ else
+ {
+ System.out.println("Please enter higher or lower as a word.");
+ return guessHiLow();
+ }
+ }
+
+ public int getBet()
+ {
+ System.out.println("How much would you like to bet in this game?");
+ System.out.println("Your account has: " + rider.getWallet());
+
+ int b= scan.nextInt();
+
+ scan.nextLine();
+ return b;
+ }
+
+
+
+ public boolean checkbet(int bet)
+ {
+ if(bet>rider.getWallet())
+ {
+ System.out.println("You do not have enough funds in your wallet for the bet you just made.");
+ return false;
+ }
+ rider.setCurrentBet(bet);
+ rider.setWallet(rider.wallet-bet);
+ retr.setCasinoBalance(retr.getCasinoBalance()-bet);
+ System.out.println("You bet has been set.");
+ return true;
+ }
+
+ public boolean checkHiLow(String guess) {
+ if (guess.equals("higher")) {
+ int current = table[index0].value;
+ table[index0] = deckobj.GetRandomCard();
+ System.out.println("The next card turned over was " + table[index0]);
+ int NewCard = table[index0].value;
+ return current < NewCard;
+ } else if (guess.equals("lower"))
+ {
+ int current = table[index0].value;
+ table[index0] = deckobj.GetRandomCard();
+ System.out.println("The next card turned over was " + table[index0]);
+ int NewCard = table[index0].value;
+ return current > NewCard;
+ }
+ return true;
+ }
+ public void react(boolean logic) {
+ if (logic == true)
+ {
+ colorConsoleGreen.println("Your guess was right, moving up!");
+ hop();
+ }
+ else if (logic == false)
+ {
+ if (getIndex0() != 0)
+ {
+ colorConsoleRed.println("Your guess was wrong, moving back!");
+ System.out.println("Your bet has been decreased by 15%");
+ rider.setCurrentBet((int) (rider.getCurrentBet()-rider.getCurrentBet()*.15));
+ back();
+ }
+ else if( getIndex0()==0) {
+ colorConsoleRed.println("Your guess was wrong but you're still at spot one.");
+ System.out.println("Your bet has been decreased by 15%");
+ rider.setCurrentBet((int) (rider.getCurrentBet() - rider.getCurrentBet() * .15));
+ }
+ }
+ }
+
+ public boolean checkColor(String guess) {
+ if (guess.equals("red")) {
+
+ table[index0] = deckobj.GetRandomCard();
+ System.out.println("The card turned over was " + table[index0]);
+ String NewColor = table[index0].color.toLowerCase();
+ return guess.equals(NewColor);
+ } else if (guess.equals("black"))
+ {
+ table[index0] = deckobj.GetRandomCard();
+ System.out.println("The card turned over was " + table[index0]);
+ String NewColor = table[index0].color.toLowerCase();
+ return guess.equals(NewColor);
+ }
+ return false;
+ }
+
+
+ public boolean checkSuit(String guess) {
+ table[index0] = deckobj.GetRandomCard();
+ System.out.println("The card turned over was " + table[index0]);
+ String NewSuit = table[index0].suit.toLowerCase();
+ return guess.equals(NewSuit);
+ }
+
+
+
+ public void gameflow() {
+ if (index0 == 0 || index0 == 1) {
+ reveal();
+ react(checkHiLow(guessHiLow()));
+ } else if (index0 == 2)
+ {
+ react(checkColor(guessColor()));
+ }
+ else if(index0==3) {
+ react(checkSuit(guessSuit()));
+ }
+ }
+
+ public String guessColor() {
+ System.out.println("Please input the color of the next card flipped over.");
+ String ret = scan.nextLine().toLowerCase();
+ if(ret.equals("red")||ret.equals("black"))
+ {
+ return ret;
+ }
+ else
+ {
+ System.out.println("Please enter the color as a word.");
+ return guessColor();
+ }
+ }
+
+ public String guessSuit() {
+ System.out.println("Please input the suit of the next card flipped over.");
+ String ret = scan.nextLine().toLowerCase();
+ if(ret.equals("spades")||ret.equals("clubs")||ret.equals("diamonds")||ret.equals("hearts"))
+ {
+ return ret;
+ }
+ else
+ {
+ System.out.println("Please enter the suit as a word.");
+ return guessSuit();
+ }
+
+ }
+
+ public void reveal() {
+ System.out.println( "The current value of the card you are guessing is " + getValue());
+ }
+
+ public void WelcomeMessage() {
+
+ System.out.println( "Welcome to Ride The Bus!");
+
+ }
+ public int getIndex0() {
+ return index0;
+ }
+ public void status()
+ {
+ if(index0<=3)
+ System.out.println("You are currently at card position " + (index0+1) + " with a bet balance of " + rider.getCurrentBet());
+ }
+
+
+ @Override
+ public void add(PlayerInterface player) {
+
+ }
+
+ @Override
+ public void remove(PlayerInterface player) {
+
+ }
+
+ @Override
+ public void run() {
+
+ }
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/RideTheBus/RideTheBusPlayer.java b/src/main/java/com/github/zipcodewilmington/casino/games/RideTheBus/RideTheBusPlayer.java
new file mode 100644
index 00000000..73d7ed9d
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/RideTheBus/RideTheBusPlayer.java
@@ -0,0 +1,31 @@
+package com.github.zipcodewilmington.casino.games.RideTheBus;
+
+import com.github.zipcodewilmington.casino.CasinoAccount;
+
+public class RideTheBusPlayer {
+
+
+ double wallet =0;
+ int currentBet=0;
+ public RideTheBusPlayer(CasinoAccount person)
+ {
+ this.wallet = person.getCasinoBalance();
+ }
+
+
+ public double getWallet() {
+ return wallet;
+ }
+
+ public void setWallet(double wallet) {
+ this.wallet = wallet;
+ }
+ public int getCurrentBet() {
+ return currentBet;
+ }
+
+ public void setCurrentBet(int currentBet) {
+ this.currentBet = currentBet;
+ }
+
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/RouletteBoard.java b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/RouletteBoard.java
new file mode 100644
index 00000000..de916e01
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/RouletteBoard.java
@@ -0,0 +1,11 @@
+//package com.github.zipcodewilmington.casino.games.Roulette;
+//
+//public enum RouletteBoard {
+// RED,
+// BLACK,
+// GREEN,
+// ODD,
+// EVEN
+//}
+//
+//
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/RouletteNumber.java b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/RouletteNumber.java
new file mode 100644
index 00000000..4f64ea7f
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/RouletteNumber.java
@@ -0,0 +1,63 @@
+//package com.github.zipcodewilmington.casino.games.Roulette;
+//
+//public enum RouletteNumber {
+// ZERO(0, RouletteBoard.GREEN, RouletteBoard.EVEN),
+// ONE(1, RouletteBoard.RED, RouletteBoard.ODD),
+// TWO(2, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// THREE(3, RouletteBoard.RED, RouletteBoard.ODD),
+// FOUR(4, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// FIVE(5, RouletteBoard.RED, RouletteBoard.ODD),
+// SIX(6, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// SEVEN(7, RouletteBoard.RED, RouletteBoard.ODD),
+// EIGHT(8, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// NINE(9, RouletteBoard.RED, RouletteBoard.ODD),
+// TEN(10, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// ELEVEN(11, RouletteBoard.RED, RouletteBoard.ODD),
+// TWELVE(12, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// THIRTEEN(13, RouletteBoard.RED, RouletteBoard.ODD),
+// FOURTEEN(14, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// FIFTEEN(15, RouletteBoard.RED, RouletteBoard.ODD),
+// SIXTEEN(16, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// SEVENTEEN(17, RouletteBoard.RED, RouletteBoard.ODD),
+// EIGHTEEN(18, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// NINETEEN(19, RouletteBoard.RED, RouletteBoard.ODD),
+// TWENTY(20, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// TWENTYONE(21, RouletteBoard.RED, RouletteBoard.ODD),
+// TWNETYTWO(22, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// TWENTYTHREE(23, RouletteBoard.BLACK, RouletteBoard.ODD),
+// TWENTYFOUR(24, RouletteBoard.RED, RouletteBoard.EVEN),
+// TWENTYFIVE(25, RouletteBoard.RED, RouletteBoard.ODD),
+// TWENTYSIX(26, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// TWENTYSEVEN(27, RouletteBoard.RED, RouletteBoard.ODD),
+// TWENTYEIGHT(28, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// TWENTYNINE(29, RouletteBoard.RED, RouletteBoard.ODD),
+// THIRTY(30, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// THIRTYONE(31, RouletteBoard.RED, RouletteBoard.ODD),
+// THIRTYTWO(32, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// THIRTYTHREE(33, RouletteBoard.RED, RouletteBoard.ODD),
+// THIRTYFOUR(34, RouletteBoard.BLACK, RouletteBoard.EVEN),
+// THIRTYFIVE(35, RouletteBoard.RED, RouletteBoard.ODD),
+// THIRTYSIX(36, RouletteBoard.BLACK, RouletteBoard.EVEN);
+//
+// private final int numberValue;
+// private final RouletteBoard color;
+// private final RouletteBoard oddOrEven;
+//
+// RouletteNumber(int numberValue, RouletteBoard color, RouletteBoard oddOrEven) {
+// this.numberValue = numberValue;
+// this.color = color;
+// this.oddOrEven = oddOrEven;
+//
+// }
+// public int getNumberValue() {
+// return numberValue;
+// }
+//
+// public RouletteBoard getColor() {
+// return color;
+// }
+//
+// public RouletteBoard getOddOrEven() {
+// return oddOrEven;
+// }
+//}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/rouletteGame.java b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/rouletteGame.java
new file mode 100644
index 00000000..85abb7b3
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/rouletteGame.java
@@ -0,0 +1,101 @@
+//package com.github.zipcodewilmington.casino.games.Roulette;
+//import com.github.zipcodewilmington.casino.CasinoAccount;
+//
+//import java.util.Random;
+//import java.util.Scanner;
+//
+//
+//public class rouletteGame{
+// private RouletteNumber[] rouletteNumbers = RouletteNumber.values();
+// private Random random = new Random();
+// static Scanner scan = new Scanner(System.in);
+//
+//
+// public void run() {
+// WelcomeMessage();
+// pushToStart();
+// rouletteMenu();
+// }
+//
+// public String WelcomeMessage()
+// {
+// StringBuilder welcome = new StringBuilder();
+// welcome.append("--------------------------------\n");
+// welcome.append("| WELCOME TO ROULETTE |\n");
+// welcome.append("| |\n");
+// welcome.append("| Please enter any key to roll |\n");
+// welcome.append("--------------------------------\n");
+// System.out.println(welcome);
+// return welcome.toString();
+// }
+//
+// public void pushToStart(){
+// {
+// scan.nextLine();
+// }
+// }
+//
+// public void rouletteMenu(){
+// while (true) {
+// System.out.println("\n Main Menu: Choose Number For Bet \n");
+// System.out.println(" 1. Bet on Color: Green/Red/Black");
+// System.out.println("2. Bet on Odd or Even");
+// System.out.println("3. Leave Table");
+// System.out.println("Please make a selection [1-3]: ");
+// System.out.println("Your Current Balance is " + roulettePlayer.getWallet());
+//
+// Integer userChoice = scan.nextInt();
+//
+// switch(userChoice){
+// case 1:
+// System.out.print("Choose a color to bet on (Red/Black/Green): ");
+// String chosenColor = scan.next();
+// try {
+// RouletteBoard betColor = RouletteBoard.valueOf(chosenColor.toUpperCase());
+// playRound(player, betAmount, betColor);
+// } catch (IllegalArgumentException e) {
+// System.out.println("Invalid color! Please choose Red, Black, or Green.");
+// }
+// break;
+// case 2:
+// System.out.print("Choose to bet on (Odd/Even): ");
+// String chooseOddEven = scan.next();
+// try {
+// RouletteBoard betNumber = RouletteBoard.valueOf(chooseOddEven.toUpperCase());
+// playRound(player, betAmount, betNumber);
+// } catch (IllegalArgumentException e) {
+// System.out.println("Invalid option! Please choose Odd/Even");
+// }
+// break;
+// case 3:
+// System.out.println("Back to Menu");
+// scan.close();
+// break;
+// default:
+// System.out.println("Invalid betting option!");
+// }
+// }
+// scan.close();
+//
+// private void playRound(roulettePlayer player, double betAmount, RouletteBet bet){
+//
+//
+// return null;
+// }
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//}
+//
+//
+//
+//
+//
+//}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/roulettePlayer.java b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/roulettePlayer.java
new file mode 100644
index 00000000..576992fa
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/roulettePlayer.java
@@ -0,0 +1,55 @@
+//package com.github.zipcodewilmington.casino.games.Roulette;
+//import com.github.zipcodewilmington.casino.CasinoAccount;
+//
+//
+//public class roulettePlayer {
+// double wallet =0;
+// int currentBet=0;
+//
+//
+// public roulettePlayer(CasinoAccount person)
+// {
+// this.wallet = person.getCasinoBalance();
+// }
+//
+//
+// public static double getWallet() {
+// return wallet;
+// }
+//
+// public void setWallet(double wallet) {
+// this.wallet = wallet;
+// }
+// public int getCurrentBet() {
+// return currentBet;
+// }
+//
+// public void setCurrentBet(int currentBet) {
+// this.currentBet = currentBet;
+// }
+//
+//
+// public void placeBet(double betAmount, int chosenNumber) {
+// if (betAmount <= 0) {
+// System.out.println("Invalid bet amount!");
+// return;
+// }
+//
+// if (betAmount > wallet) {
+// System.out.println("Insufficient balance!");
+// return;
+// }
+//
+// RouletteNumber betNumber = RouletteNumber.valueOf("N" + chosenNumber);
+// rouletteGame.playRound(this, betAmount, betNumber);
+// }
+//
+//
+//}
+//
+//
+//
+//
+//
+//
+//}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/rouletteTable.java b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/rouletteTable.java
new file mode 100644
index 00000000..640de75e
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/rouletteTable.java
@@ -0,0 +1,79 @@
+//package com.github.zipcodewilmington.casino.games.Roulette;
+//
+//import java.util.ArrayList;
+//import java.util.HashMap;
+//import java.util.Random;
+//
+//
+//public class rouletteTable {
+// private final ArrayList numbers;
+//
+// private final HashMap