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/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..82d7683e 100644
--- a/src/main/java/com/github/zipcodewilmington/Casino.java
+++ b/src/main/java/com/github/zipcodewilmington/Casino.java
@@ -4,6 +4,7 @@
import com.github.zipcodewilmington.casino.CasinoAccountManager;
import com.github.zipcodewilmington.casino.GameInterface;
import com.github.zipcodewilmington.casino.PlayerInterface;
+import com.github.zipcodewilmington.casino.games.RideTheBus.RideTheBusGame;
import com.github.zipcodewilmington.casino.games.numberguess.NumberGuessGame;
import com.github.zipcodewilmington.casino.games.numberguess.NumberGuessPlayer;
import com.github.zipcodewilmington.casino.games.slots.SlotsGame;
@@ -19,6 +20,8 @@ public class Casino implements Runnable {
@Override
public void run() {
+ CasinoAccountManager.addAllAccounts();
+
String arcadeDashBoardInput;
CasinoAccountManager casinoAccountManager = new CasinoAccountManager();
do {
@@ -26,14 +29,23 @@ public void run() {
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();
+ ride.start();
+
} else {
// TODO - implement better exception handling
String errorMessage = "[ %s ] is an invalid game selection";
@@ -49,7 +61,8 @@ 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));
}
@@ -66,11 +79,11 @@ 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 ]")
.toString());
}
- private void play(Object gameObject, Object playerObject) {
+ private void play(Object gameObject, Object playerObject) throws InterruptedException {
GameInterface game = (GameInterface)gameObject;
PlayerInterface player = (PlayerInterface)playerObject;
game.add(player);
diff --git a/src/main/java/com/github/zipcodewilmington/CasinoWar.java b/src/main/java/com/github/zipcodewilmington/CasinoWar.java
new file mode 100644
index 00000000..70fe3be3
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/CasinoWar.java
@@ -0,0 +1,141 @@
+package com.github.zipcodewilmington;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Scanner;
+
+public class CasinoWar {
+
+ public static void main(String[] args) {
+ playCasinoWar();
+ }
+
+ static void playCasinoWar() {
+ Scanner scanner = new Scanner(System.in);
+
+ // Change to call deck
+ List deck = createShuffledDeck();
+
+ int playerScore = 0;
+ int dealerScore = 0;
+
+ while (!deck.isEmpty()) {
+ // Player's turn
+ System.out.println("Press Enter to draw a card.");
+ scanner.nextLine();
+ String playerCard = drawCard(deck);
+ System.out.println("You drew: " + playerCard);
+ int playerCardValue = getCardValue(playerCard);
+
+ // Dealer's turn
+ System.out.println("Press Enter for the dealer to draw a card.");
+ scanner.nextLine();
+ String dealerCard = drawCard(deck);
+ System.out.println("Dealer drew: " + dealerCard + "\n");
+ int dealerCardValue = getCardValue(dealerCard);
+
+ // Compare the cards
+ if (playerCardValue > dealerCardValue) {
+ System.out.println("You win this round!");
+ playerScore++;
+ } else if (dealerCardValue > playerCardValue) {
+ 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 < 2; i++) {
+ playerWarCards.add(drawCard(deck));
+ dealerWarCards.add(drawCard(deck));
+ }
+
+ // Get the fourth card for comparison
+ String playerFourthCard = drawCard(deck);
+ String dealerFourthCard = drawCard(deck);
+
+ 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.");
+ }
+ }
+
+
+ // 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!");
+ break;
+ }
+
+
+ // Ask the player if they want to continue playing
+ System.out.println("\n Press enter to play again or (exit) to leave.");
+ String input = scanner.nextLine();
+ if (input.equalsIgnoreCase("exit")) {
+ System.out.println("Thanks for playing! Final scores:");
+ System.out.println("Your score: " + playerScore);
+ System.out.println("Dealer's score: " + dealerScore);
+ break;
+ }
+ }
+
+ scanner.close();
+ }
+
+ private static 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 static String drawCard(List deck) {
+ return deck.remove(deck.size() - 1);
+ }
+
+ private static 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);
+ }
+ }
+
+
+}
+
+
diff --git a/src/main/java/com/github/zipcodewilmington/MainApplication.java b/src/main/java/com/github/zipcodewilmington/MainApplication.java
index 508787a8..237528ee 100644
--- a/src/main/java/com/github/zipcodewilmington/MainApplication.java
+++ b/src/main/java/com/github/zipcodewilmington/MainApplication.java
@@ -2,6 +2,7 @@
public class MainApplication {
public static void main(String[] args) {
+
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..a4bc2cb8
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/Accounts.txt
@@ -0,0 +1,4 @@
+Santos,Santos,123,100.0
+BobLee,BobLee,4321,0.0
+hans,hans,4321,0.0
+bans,bans,4321,0.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..b58f4b53 100644
--- a/src/main/java/com/github/zipcodewilmington/casino/CasinoAccount.java
+++ b/src/main/java/com/github/zipcodewilmington/casino/CasinoAccount.java
@@ -6,4 +6,49 @@
* 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 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..6bbee95e 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`
*
@@ -26,10 +58,19 @@ public CasinoAccount getAccount(String accountName, String accountPassword) {
* @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;
+
+
}
/**
@@ -38,9 +79,72 @@ 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 {
+
+ // create new BufferedWriter for the output file
+ bf = new BufferedWriter(new FileWriter(file));
+
+ // iterate map entries
+ 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/games/BlackJack/BlackJack.java b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJack.java
new file mode 100644
index 00000000..642f39af
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/BlackJack.java
@@ -0,0 +1,20 @@
+package com.github.zipcodewilmington.casino.games.BlackJack;
+import com.github.zipcodewilmington.casino.games.Deck;
+
+public class BlackJack {
+
+ // created variables for the blackjack game class
+ private int wins;
+ private int losses;
+ private int pushes;
+
+//created a constructor for the blackjack game class
+ public BlackJack(){
+ wins = 0;
+ losses = 0;
+ pushes = 0; //anytime a blackjack object is made it is automatically going to be 0
+ }
+ //create and start the game here
+
+
+}
diff --git a/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/Rank.java b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/Rank.java
new file mode 100644
index 00000000..e27f8502
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/Rank.java
@@ -0,0 +1,28 @@
+package com.github.zipcodewilmington.casino.games.BlackJack;
+
+public enum Rank {
+
+ 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;
+ Rank(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/Suit.java b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/Suit.java
new file mode 100644
index 00000000..116695e3
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/BlackJack/Suit.java
@@ -0,0 +1,22 @@
+package com.github.zipcodewilmington.casino.games.BlackJack;
+
+public enum Suit {
+
+
+ CLUB("Clubs"),
+ DIAMOND("Diamonds"),
+ HEART("Hearts"),
+ SPADE("Spades");
+ String suitName;
+
+ Suit(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/Deck.java b/src/main/java/com/github/zipcodewilmington/casino/games/Deck.java
new file mode 100644
index 00000000..84f8cbac
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/Deck.java
@@ -0,0 +1,38 @@
+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/RideTheBus/RideTheBusGame.java b/src/main/java/com/github/zipcodewilmington/casino/games/RideTheBus/RideTheBusGame.java
new file mode 100644
index 00000000..36f703c4
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/RideTheBus/RideTheBusGame.java
@@ -0,0 +1,250 @@
+package com.github.zipcodewilmington.casino.games.RideTheBus;
+
+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 {
+ public RideTheBusPlayer getRider() {
+ return rider;
+ }
+
+ RideTheBusPlayer rider;
+ Deck deckobj = new Deck();
+ Card[] table = new Card[4];
+ int index0;
+ Scanner scan = new Scanner(System.in);
+
+ 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();
+ 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 = rider.getCurrentBet()*2;
+ System.out.println("Your returns are: " + winnings);
+ rider.setWallet(rider.getWallet()+winnings);
+ }
+ }
+
+ 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?");
+
+ 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);
+ 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)
+ {
+ System.out.println("Your guess was right, moving up!");
+ hop();
+ }
+ else if (logic == false)
+ {
+ if (getIndex0() != 0)
+ {
+ System.out.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) {
+ System.out.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()
+ {
+ System.out.println("You are currently at card position " + (index0+1) + " with a bet balance of " + rider.getCurrentBet());
+ }
+
+
+}
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..7883d331
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/RideTheBus/RideTheBusPlayer.java
@@ -0,0 +1,29 @@
+package com.github.zipcodewilmington.casino.games.RideTheBus;
+
+public class RideTheBusPlayer {
+
+
+ double wallet =0;
+ int currentBet=0;
+ public RideTheBusPlayer()
+ {
+ this.wallet = 10000;
+ }
+
+
+ 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/rouletteGame.java b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/rouletteGame.java
new file mode 100644
index 00000000..c7555d54
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/rouletteGame.java
@@ -0,0 +1,8 @@
+package com.github.zipcodewilmington.casino.games.Roulette;
+
+public class rouletteGame {
+
+
+
+
+}
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..fd703f90
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/roulettePlayer.java
@@ -0,0 +1,8 @@
+package com.github.zipcodewilmington.casino.games.Roulette;
+
+public class roulettePlayer {
+
+
+
+
+}
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..7a69d94e
--- /dev/null
+++ b/src/main/java/com/github/zipcodewilmington/casino/games/Roulette/rouletteTable.java
@@ -0,0 +1,80 @@
+package com.github.zipcodewilmington.casino.games.Roulette;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Random;
+
+
+public class rouletteTable {
+ private ArrayList numbers;
+ private String colors;
+ Random random = new Random();
+
+
+
+ public rouletteTable(ArrayList numbers) {
+ this.numbers = numbers;
+
+ rouletteGetNumbers();
+ rouletteGetColors();
+ }
+
+ private void rouletteGetNumbers () {
+ for (int i = 0; i <= 36; i++) {
+ numbers.add(i);
+ }
+ }
+ private void rouletteGetColors () {
+ HashMap