diff --git a/.gitignore b/.gitignore
index 53c83987d..14d9a6ea5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@ local.properties
.settings/
.loadpath
.recommenders
+.DS_Store
# External tool builders
.externalToolBuilders/
diff --git a/pom.xml b/pom.xml
index c6ec0cc8b..7cb013fb4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,6 +7,18 @@
io.zipcoder
casino
1.0-SNAPSHOT
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 8
+
+
+
+
@@ -15,5 +27,10 @@
4.12
test
+
+ com.h2database
+ h2
+ 1.4.197
+
diff --git a/sounds/dice_roll.wav b/sounds/dice_roll.wav
new file mode 100644
index 000000000..6005833ba
Binary files /dev/null and b/sounds/dice_roll.wav differ
diff --git a/sounds/ladder.wav b/sounds/ladder.wav
new file mode 100644
index 000000000..bbb19007f
Binary files /dev/null and b/sounds/ladder.wav differ
diff --git a/sounds/snake_hiss.wav b/sounds/snake_hiss.wav
new file mode 100644
index 000000000..ad3826b51
Binary files /dev/null and b/sounds/snake_hiss.wav differ
diff --git a/sounds/spend_money.wav b/sounds/spend_money.wav
new file mode 100644
index 000000000..c84bf46d6
Binary files /dev/null and b/sounds/spend_money.wav differ
diff --git a/sounds/ui_typing.wav b/sounds/ui_typing.wav
new file mode 100644
index 000000000..a06e032f3
Binary files /dev/null and b/sounds/ui_typing.wav differ
diff --git a/sounds/wahwah.wav b/sounds/wahwah.wav
new file mode 100644
index 000000000..7113e3f5c
Binary files /dev/null and b/sounds/wahwah.wav differ
diff --git a/sounds/win_money.wav b/sounds/win_money.wav
new file mode 100644
index 000000000..49e750d02
Binary files /dev/null and b/sounds/win_money.wav differ
diff --git a/sounds/win_sound.wav b/sounds/win_sound.wav
new file mode 100644
index 000000000..88e558c6d
Binary files /dev/null and b/sounds/win_sound.wav differ
diff --git a/src/main/java/io/zipcoder/casino/Casino.java b/src/main/java/io/zipcoder/casino/Casino.java
deleted file mode 100644
index 16ca0dd74..000000000
--- a/src/main/java/io/zipcoder/casino/Casino.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package io.zipcoder.casino;
-
-
-public class Casino {
- public static void main(String[] args) {
- // write your tests before you start fucking with this
- }
-}
diff --git a/src/main/java/io/zipcoder/casino/CasinoMain.java b/src/main/java/io/zipcoder/casino/CasinoMain.java
new file mode 100644
index 000000000..c1870272b
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/CasinoMain.java
@@ -0,0 +1,10 @@
+package io.zipcoder.casino;
+
+import io.zipcoder.casino.PlayerMenu;
+
+public class CasinoMain {
+ public static void main(String[] args) {
+ PlayerMenu playerMenu = new PlayerMenu();
+ playerMenu.runPlayerMenu();
+ }
+}
diff --git a/src/main/java/io/zipcoder/casino/GamePieces/Card.java b/src/main/java/io/zipcoder/casino/GamePieces/Card.java
new file mode 100644
index 000000000..c20cf3c28
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/GamePieces/Card.java
@@ -0,0 +1,33 @@
+package io.zipcoder.casino.GamePieces;
+
+public class Card implements Comparable {
+ private Suit suit;
+ private CardValue cardValue;
+
+ public Card (CardValue cardValue, Suit suit){
+ this.cardValue= cardValue;
+ this.suit = suit;
+ }
+
+ public Suit getSuit() {
+ return suit;
+ }
+
+ public void setSuit(Suit suit) {
+ this.suit = suit;
+ }
+
+ public CardValue getCardValue() {
+ return cardValue;
+ }
+
+ public void setCardValue(CardValue cardValue) {
+ this.cardValue = cardValue;
+
+ }
+
+ @Override
+ public int compareTo(Card o) {
+ return Integer.compare(this.cardValue.getValue(), o.cardValue.getValue());
+ }
+}
diff --git a/src/main/java/io/zipcoder/casino/GamePieces/CardValue.java b/src/main/java/io/zipcoder/casino/GamePieces/CardValue.java
new file mode 100644
index 000000000..8ffd404c3
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/GamePieces/CardValue.java
@@ -0,0 +1,54 @@
+package io.zipcoder.casino.GamePieces;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum CardValue {
+
+ TWO(2),
+ THREE(3),
+ FOUR(4),
+ FIVE(5),
+ SIX(6),
+ SEVEN(7),
+ EIGHT(8),
+ NINE(9),
+ TEN(10),
+ JACK(11),
+ QUEEN(12),
+ KING(13),
+ ACE(14);
+
+ private final int value;
+ private CardValue (int value){
+ this.value = value;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+ public String toString() {
+ if (value == 14) {
+ return "ace";
+ } else if (value == 13) {
+ return "king";
+ } else if (value == 12) {
+ return "queen";
+ } else if (value == 11) {
+ return "jack";
+ } else {
+ return value + "";
+ }
+ }
+
+ private static final Map intToTypeMap = new HashMap();
+ static {
+ for (CardValue type : CardValue.values()) {
+ intToTypeMap.put(type.value, type);
+ }
+ }
+ public static CardValue fromInt(int i) {
+ return intToTypeMap.get(i);
+ }
+}
diff --git a/src/main/java/io/zipcoder/casino/GamePieces/Deck.java b/src/main/java/io/zipcoder/casino/GamePieces/Deck.java
new file mode 100644
index 000000000..d00d7037b
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/GamePieces/Deck.java
@@ -0,0 +1,41 @@
+package io.zipcoder.casino.GamePieces;
+
+import io.zipcoder.casino.utilities.Console;
+
+import java.util.ArrayList;
+import java.util.*;
+
+public class Deck {
+
+ Console console = new Console(System.in,System.out);
+ ArrayList deck = new ArrayList<>();
+
+ public Deck(){
+ this.deck = deck;
+ for(int i =0; i <= 12; i++){
+ CardValue value = CardValue.values()[i];
+ for(int j= 0; j < 4;j++){
+ Card card= new Card(value, Suit.values()[j]);
+ this.deck.add(card);
+ }
+
+ }
+ }
+
+ public Integer cardsLeft() {
+ return deck.size();
+ }
+
+ public void shuffle(){
+ Collections.shuffle(deck);
+ }
+
+ public Card draw(){
+
+
+ Card drawCard = deck.remove(0);
+
+ return drawCard;
+
+ }
+}
diff --git a/src/main/java/io/zipcoder/casino/GamePieces/Dice.java b/src/main/java/io/zipcoder/casino/GamePieces/Dice.java
new file mode 100644
index 000000000..dd8a5ea79
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/GamePieces/Dice.java
@@ -0,0 +1,54 @@
+package io.zipcoder.casino.GamePieces;
+
+import io.zipcoder.casino.utilities.Console;
+
+import java.util.HashMap;
+import java.util.Random;
+
+public class Dice {
+ Console console = new Console(System.in, System.out);
+
+ public Integer rollDice(Integer numberOfDice){
+ Random r = new Random();
+ Integer sum = 0;
+ for(int i = 0; i < numberOfDice; i++){
+ sum += r.nextInt(6) + 1;
+ }
+ return sum;
+ }
+
+ public String diceArt(Integer roll){
+ HashMap diceMap = new HashMap<>();
+ diceMap.put(1,"+-----+\n" +
+ "| |\n" +
+ "| o |\n" +
+ "| |\n" +
+ "+-----+");
+ diceMap.put(2,"+-----+\n" +
+ "| o |\n" +
+ "| |\n" +
+ "| o |\n" +
+ "+-----+");
+ diceMap.put(3,"+-----+\n" +
+ "| o |\n" +
+ "| o |\n" +
+ "| o |\n" +
+ "+-----+");
+ diceMap.put(4,"+-----+\n" +
+ "| o o |\n" +
+ "| |\n" +
+ "| o o |\n" +
+ "+-----+");
+ diceMap.put(5,"+-----+\n" +
+ "| o o |\n" +
+ "| o |\n" +
+ "| o o |\n" +
+ "+-----+");
+ diceMap.put(6,"+-----+\n" +
+ "| o o |\n" +
+ "| o o |\n" +
+ "| o o |\n" +
+ "+-----+");
+ return diceMap.get(roll);
+ }
+}
diff --git a/src/main/java/io/zipcoder/casino/GamePieces/RouletteSpinner.java b/src/main/java/io/zipcoder/casino/GamePieces/RouletteSpinner.java
new file mode 100644
index 000000000..a34e745b3
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/GamePieces/RouletteSpinner.java
@@ -0,0 +1,12 @@
+package io.zipcoder.casino.GamePieces;
+
+import java.util.Random;
+
+public class RouletteSpinner {
+ private static Random random = new Random();
+
+ public static Integer winningNumber() {
+ return random.nextInt(37);
+ }
+
+}
diff --git a/src/main/java/io/zipcoder/casino/GamePieces/SlotMachine.java b/src/main/java/io/zipcoder/casino/GamePieces/SlotMachine.java
new file mode 100644
index 000000000..7c89bd012
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/GamePieces/SlotMachine.java
@@ -0,0 +1,37 @@
+package io.zipcoder.casino.GamePieces;
+
+import io.zipcoder.casino.Games.GamblingGame;
+import io.zipcoder.casino.utilities.Console;
+
+import java.util.Random;
+import java.util.Arrays;
+
+public class SlotMachine {
+
+ Console console = new Console(System.in, System.out);
+
+ Integer[][] slotMachine = new Integer[3][3];
+
+ public SlotMachine(Integer[][] slot){
+ this.slotMachine = slot;
+ }
+
+ public static Integer randNum(){
+ Random random = new Random();
+ Integer randInt = random.nextInt(10);
+ return randInt;
+ }
+
+
+ public Integer[][] createMachine() {
+ for (int i = 0; i < slotMachine.length; i++){
+ for(int j = 0; j < slotMachine.length; j++){
+ slotMachine[i][j] = randNum();
+ }
+ } return slotMachine;
+ }
+
+ public void printSlots(){
+ console.println(slotMachine.toString());
+ }
+}
diff --git a/src/main/java/io/zipcoder/casino/GamePieces/SnakesLaddersPiece.java b/src/main/java/io/zipcoder/casino/GamePieces/SnakesLaddersPiece.java
new file mode 100644
index 000000000..8c4aae0e1
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/GamePieces/SnakesLaddersPiece.java
@@ -0,0 +1,13 @@
+package io.zipcoder.casino.GamePieces;
+
+public class SnakesLaddersPiece {
+ private Integer currentPosition = 0;
+
+ public Integer getCurrentPosition() {
+ return currentPosition;
+ }
+
+ public void setCurrentPosition(Integer currentPosition) {
+ this.currentPosition = currentPosition;
+ }
+}
diff --git a/src/main/java/io/zipcoder/casino/GamePieces/Suit.java b/src/main/java/io/zipcoder/casino/GamePieces/Suit.java
new file mode 100644
index 000000000..2d62cd40d
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/GamePieces/Suit.java
@@ -0,0 +1,9 @@
+package io.zipcoder.casino.GamePieces;
+
+public enum Suit {
+
+ HEARTS,
+ SPADES,
+ CLUBS,
+ DIAMONDS;
+}
diff --git a/src/main/java/io/zipcoder/casino/Games/Blackjack/BlackJack.java b/src/main/java/io/zipcoder/casino/Games/Blackjack/BlackJack.java
new file mode 100644
index 000000000..0543f168f
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/Games/Blackjack/BlackJack.java
@@ -0,0 +1,442 @@
+package io.zipcoder.casino.Games.Blackjack;
+
+import io.zipcoder.casino.utilities.CasinoArt;
+import io.zipcoder.casino.GamePieces.Card;
+
+
+import io.zipcoder.casino.Games.GamblingGame;
+import io.zipcoder.casino.Games.Game;
+
+import io.zipcoder.casino.Menus.Casino;
+
+
+import io.zipcoder.casino.PlayerCreation.Player;
+import io.zipcoder.casino.GamePieces.Deck;
+import io.zipcoder.casino.utilities.Console;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+
+public class BlackJack implements Game, GamblingGame {
+
+
+ Deck deck = null;
+ Console console = new Console(System.in, System.out);
+ Card[] playerHand = new Card[6];
+ Card[] dealerHand = new Card[6];
+ private Player currentPlayer;
+ Player dealer = new Player("Dealer", 100000);
+ private CasinoArt art = new CasinoArt();
+ boolean running = true;
+ boolean alsoRunning = true;
+ Integer pot = 0;
+ Integer handOfPlayer = checkHand(playerHand);
+ Integer handOfDealer = checkHand(dealerHand);
+ private DateTimeFormatter dateTimeFormatter = java.time.format.DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
+
+ public Player getWinner() {
+ return winner;
+ }
+
+ private Player winner = null;
+ private Integer totalEarnings = 0;
+
+
+ public void runBlackJack(Player currentPlayer) {
+ alsoRunning = true;
+ running = true;
+ this.currentPlayer = currentPlayer;
+ approachTable(currentPlayer);
+ }
+
+
+ @Override
+ public void runGame(Player currentplayer) {
+
+
+ while (running == true) {
+ this.deck = new Deck();
+ winner = null;
+
+ console.println("Welcome to BlackJack! Let's begin!");
+
+ deck.shuffle();
+ initialHand();
+
+ viewDealerHand();
+ viewCurrentHand();
+
+ console.println("How much would you like to los- I mean bet?" + " Current balance: $" + currentplayer.getBalance());
+ placeBet(currentPlayer);
+ if (running == true) {
+ houseWin();
+
+
+ if (winner == null) {
+
+ viewDealerHand();
+ viewCurrentHand();
+
+ hitOrStay();
+
+ checkHand(playerHand);
+ checkHand(dealerHand);
+ dealerMove();
+ checksWinner();
+
+ exitGame(currentPlayer);
+ } else {
+ exitGame(currentPlayer);
+ }
+ }
+ }
+ }
+
+
+ @Override
+ public void approachTable(Player currentPLayer) {
+ while (alsoRunning == true) {
+ Console.clearScreen();
+ this.currentPlayer = currentPLayer;
+ console.println(art.getCasinoArt(CasinoArt.Art.BLACKJACK));
+ console.println("You approach the BlackJack table. What would you like to do?");
+ console.println("(1) - Play the game");
+ console.println("(2) - Read the rules");
+ console.println("(3) - Return to the game menu");
+ Integer playerInput = console.getIntegerInput(":");
+
+ switch (playerInput) {
+ case 1:
+ running = true;
+ runGame(currentPlayer);
+
+ break;
+ case 2:
+
+ approachTable(currentPlayer);
+
+ break;
+ case 3:
+
+ alsoRunning = false;
+
+ break;
+ }
+ }
+ }
+
+
+ @Override
+ public void placeBet(Player currentPlayer) {
+ Integer playerBet = console.getIntegerInput(":");
+ if (currentPlayer.getBalance() <= 0) {
+ console.printSlow("Git yo broke ass ouuta heeerrre Bruhh! ! ! !");
+ console.delay(3500);
+ alsoRunning = false;
+ running = false;
+ } else if (currentPlayer.getBalance() < playerBet) {
+ console.printSlow(" Not enough cheddar! Bet a different amount");
+ console.delay(3500);
+ placeBet(currentPlayer);
+ } else {
+ currentPlayer.placeBet(playerBet);
+ pot = playerBet;
+
+ }
+ }
+
+ @Override
+ public void returnWinnings(Player currentPlayer, Integer results) {
+
+ }
+
+ public int blackJackCardValue(Card c) {
+ int card = c.getCardValue().getValue();
+ if (card > 10 && card < 14) {
+ card = 10;
+ } else if (card == 14) {
+ card = 11;
+ }
+ return card;
+ }
+
+ public void viewCurrentHand() {
+ console.println("Your hand is " + String.valueOf(blackJackCardValue(playerHand[0])) + " " + String.valueOf(blackJackCardValue(playerHand[1])));
+ }
+
+ public void viewDealerHand() {
+
+ console.println("Dealer hand is " + String.valueOf(blackJackCardValue(dealerHand[0])));
+ }
+
+ public void hitOrStay() {
+
+ handOfPlayer = checkHand(playerHand);
+ console.println("Would you like to 'hit' or 'stay'?");
+ String playerInput = console.getStringInput(":");
+
+
+ if (!notBusted(checkHand(playerHand))) {
+
+
+ } else if (playerInput.equals("hit")) {
+ handOfPlayer = checkHand(playerHand);
+ if (!notBusted(checkHand(playerHand))) {
+
+ }
+
+ hit();
+
+
+ } else if (playerInput.equals("stay")) {
+
+ stay();
+
+ } else {
+ console.println("Not a choice");
+ hitOrStay();
+ }
+
+ }
+
+ public void hit() {
+
+
+ if (playerHand[2] == null) {
+ playerHand[2] = deck.draw();
+ handOfPlayer = checkHand(playerHand);
+ console.println("This is your hand " + handOfPlayer);
+ if (notBusted(checkHand(playerHand))) {
+ hitOrStay();
+
+ }
+ } else if (playerHand[2] != null && playerHand[3] == null) {
+
+ handOfPlayer = checkHand(playerHand);
+ playerHand[3] = deck.draw();
+ handOfPlayer = checkHand(playerHand);
+ if (notBusted(checkHand(playerHand))) {
+ console.println("This is your hand " + handOfPlayer);
+ hitOrStay();
+ }
+ } else if (playerHand[3] != null && playerHand[4] == null) {
+ handOfPlayer = checkHand(playerHand);
+ console.println("This is your hand " + handOfPlayer);
+ playerHand[4] = deck.draw();
+ handOfPlayer = checkHand(playerHand);
+ if (notBusted(checkHand(playerHand))) {
+ console.println("This is your hand " + handOfPlayer);
+ hitOrStay();
+ }
+
+ } else if (playerHand[4] != null && checkHand(playerHand) < 21) {
+ specialFive();
+ }
+
+
+ }
+
+
+ public Boolean notBusted(Integer handValue) {
+ if (handValue > 21) {
+ return false;
+ }
+ return true;
+
+
+ }
+
+ public void stay() {
+ console.println("You chose to stay");
+ viewCurrentHand();
+
+
+ }
+
+ public void isWinner(Player currentPlayer) {
+ winner = currentPlayer;
+ Integer winnings = pot * 2;
+ currentPlayer.changeBalance(winnings);
+ console.println("You won $" + winnings);
+
+ }
+
+ public void isLoser() {
+ console.println("You lost $" + pot);
+ winner = dealer;
+
+ }
+
+ public Integer checkHand(Card[] hand) {
+ int handValue = 0;
+ for (Integer i = 0; i < hand.length; i++) {
+ if (hand[i] != null) {
+ handValue += blackJackCardValue(hand[i]);
+ }
+ }
+ if (notBusted(handValue)) {
+
+ }
+
+ return handValue;
+
+ }
+
+ public void initialHand() {
+ dealerHand[0] = deck.draw();
+ dealerHand[1] = deck.draw();
+ playerHand[0] = deck.draw();
+ playerHand[1] = deck.draw();
+
+ for (int i = 2; i < dealerHand.length - 1; i++) {
+ dealerHand[i] = null;
+ }
+ for (int i = 2; i < playerHand.length - 1; i++) {
+ playerHand[i] = null;
+ }
+
+ }
+
+ public void specialFive() {
+ isWinner(currentPlayer);
+ }
+
+ @Override
+ public void exitGame(Player currentPlayer) {
+ if (winner.equals(currentPlayer)) {
+ LocalDateTime now = LocalDateTime.now();
+ currentPlayer.addHistory("You won $" + pot + " at BLACKJACK. ** " + dateTimeFormatter.format(now) + "!");
+ } else if (winner.equals(dealer)) {
+ LocalDateTime now = LocalDateTime.now();
+ currentPlayer.addHistory("You lost $" + pot + " at BLACKJACK. ** " + dateTimeFormatter.format(now));
+ }
+
+ console.println("Would you like to play again?");
+ console.println("(1) - Yes");
+ console.println("(2) - No");
+
+
+ Integer playerInput = console.getIntegerInput(":");
+ switch (playerInput) {
+ case 1:
+ // Card[] playerHand = playerHand[6];
+ runGame(currentPlayer);
+
+ break;
+ case 2:
+ //approachTable(currentPlayer);
+
+ running = false;
+
+ break;
+
+ }
+ }
+
+ public void dealerMove() {
+ Integer value = checkHand(dealerHand);
+ Integer counter = 2;
+
+
+ if (value == 16 || value == 17) {
+ //dealer cheat method
+ } else if (value >= 18 && value <= 21 && dealerHand[5] != null) {
+ console.println("Dealer Chose to stay");
+
+ } else if (value <= 21 && dealerHand[5] != null) {
+ console.println("Unlucky... \nThe Dealer wins with Special Five");
+ isLoser();
+
+
+ } else if (value <= 15) {
+ dealerHand[counter] = deck.draw();
+ counter++;
+
+ } else if (value > 21) {
+ console.println("Dealer Bust...");
+
+
+ }
+ }
+
+
+ private Boolean checkForBlackjack(Card[] hand) {
+ if (checkHand(hand) == 21) {
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+
+ private void houseWin() {
+ checkHand(dealerHand);
+ checkHand(playerHand);
+
+ if (checkForBlackjack(dealerHand) && checkForBlackjack(playerHand)) {
+ Integer handOfPlayer = checkHand(playerHand);
+ Integer handOfDealer = checkHand(dealerHand);
+ console.println("Your Hand was " + handOfPlayer);
+ console.println("Dealers Hand was " + handOfDealer);
+ console.println("The house wins!");
+
+ isLoser();
+
+ } else if (checkForBlackjack(playerHand)) {
+ handOfPlayer = checkHand(playerHand);
+ handOfDealer = checkHand(dealerHand);
+ console.println("Your Hand was " + handOfPlayer);
+ console.println("Dealers Hand was " + handOfDealer);
+ console.println("Congratulations you got BLACKJACK!");
+
+ isWinner(currentPlayer);
+
+ } else if (checkForBlackjack(dealerHand)) {
+ Integer handOfPlayer = checkHand(playerHand);
+ Integer handOfDealer = checkHand(dealerHand);
+ console.println("Your Hand was " + handOfPlayer);
+ console.println("Dealers Hand was " + handOfDealer);
+ console.println("The Dealer wins!");
+
+ isLoser();
+
+ }
+ }
+
+ private void checksWinner() {
+ Integer handOfPlayer = checkHand(playerHand);
+ Integer handOfDealer = checkHand(dealerHand);
+ if (checkHand(playerHand) > checkHand(dealerHand) && checkHand(playerHand) <= 21) {
+
+ console.println("Your Hand was " + handOfPlayer);
+ console.println("Dealers Hand was " + handOfDealer);
+ console.println("Congratulations you Won!");
+
+ isWinner(currentPlayer);
+ } else if (checkHand(playerHand) < checkHand(dealerHand) && checkHand(dealerHand) <= 21) {
+
+ console.println("Your Hand was " + handOfPlayer);
+ console.println("Dealers Hand was " + handOfDealer);
+ console.println("Hope you like ramen noodles....");
+
+ isLoser();
+ } else if (checkHand(playerHand) < checkHand(dealerHand) && checkHand(dealerHand) > 21) {
+
+ console.println("Your Hand was " + handOfPlayer);
+ console.println("Dealers Hand was " + handOfDealer);
+ console.println("Congratulations you Won! Dealer Busted Out!");
+
+ isWinner(currentPlayer);
+ } else {
+
+ console.println("Your Hand was " + handOfPlayer);
+ console.println("Dealers Hand was " + handOfDealer);
+ console.println("Busted Out! Hope you like ramen noodles....");
+
+ isLoser();
+ }
+ }
+
+}
+
diff --git a/src/main/java/io/zipcoder/casino/Games/Craps/Craps.java b/src/main/java/io/zipcoder/casino/Games/Craps/Craps.java
new file mode 100644
index 000000000..397579ba7
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/Games/Craps/Craps.java
@@ -0,0 +1,211 @@
+package io.zipcoder.casino.Games.Craps;
+
+import io.zipcoder.casino.utilities.CasinoArt;
+import io.zipcoder.casino.GamePieces.Dice;
+import io.zipcoder.casino.Games.GamblingGame;
+import io.zipcoder.casino.Games.Game;
+import io.zipcoder.casino.PlayerCreation.Player;
+import io.zipcoder.casino.utilities.Console;
+import io.zipcoder.casino.utilities.Sound;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+public class Craps implements Game, GamblingGame {
+
+ private DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
+ private Console console = new Console(System.in, System.out);
+ private Integer playerBet;
+ private boolean running;
+ private CasinoArt art = new CasinoArt();
+ private Dice dice;
+ private int puckVal;
+
+ private Sound spendSound;
+ private Sound moneySound;
+ private Sound loseSound;
+ private Sound diceSound;
+
+ public Craps() {
+ dice = new Dice();
+ running = false;
+ playerBet = 0;
+
+ spendSound = new Sound("spend_money.wav");
+ moneySound = new Sound("win_money.wav");
+ loseSound = new Sound("wahwah.wav");
+ diceSound = new Sound("dice_roll.wav");
+
+ }
+
+
+ @Override
+ public void approachTable(Player currentPLayer) {
+ Console.clearScreen();
+ console.printFast(art.getCasinoArt(CasinoArt.Art.CRAPS));
+ console.printSlow("As you approach the Craps table you hear yelling and shouting");
+ console.dotDotDot();
+ console.newln();
+ console.printSlow("Would you like to play?\n");
+ console.delay(500);
+ console.printSlow("(1) Yes\n");
+ console.printSlow("(2) No\n");
+
+ String input = console.getStringInput(":");
+
+ switch (input) {
+ case "1":
+ runGame(currentPLayer);
+ break;
+ case "2":
+ console.printSlow("That's too bad");
+ console.dotDotDot();
+ console.newln();
+ break;
+ default:
+ console.print("Invalid Input");
+ console.dotDotDot();
+ console.newln();
+ console.delay(2000);
+ approachTable(currentPLayer);
+ break;
+ }
+ }
+
+ @Override
+ public void runGame(Player currentPlayer) {
+ running = true;
+ while (running) {
+
+ placeBet(currentPlayer);
+
+ if(comeOutRoll(currentPlayer)) {
+ boolean passRoll = true;
+ while (passRoll) {
+ passRoll = passRoll(currentPlayer);
+ }
+ }
+
+ running = playAgain();
+ }
+ }
+
+ public Integer roll() {
+ console.getStringInput("");
+ console.dotDotDot(); console.newln();
+
+ console.delay(500);
+ diceSound.play();
+ Integer roll1 = dice.rollDice(1);
+ console.printFast(dice.diceArt(roll1) + "\n");
+ Integer roll2 = dice.rollDice(1);
+ console.printFast(dice.diceArt(roll2) + "\n");
+
+ return roll1 + roll2;
+ }
+
+ private boolean comeOutRoll(Player currentPlayer) {
+ console.printSlow("\nHit Return to Throw the Come-Out Roll\n");
+ Integer roll = roll();
+ console.printSlow("You Rolled " + roll + "!\n");
+
+ if (roll.equals(2) || roll.equals(3) || roll.equals(12)) {
+ console.print("Craps");
+ console.dotDotDot();
+ console.newln();
+ currentPlayer.addHistory("You lost $" + playerBet + " playing Craps ** " + timeFormatter.format(LocalDateTime.now()));
+ loseSound.play();
+ return false;
+ } else if (roll.equals(7) || roll.equals(11)) {
+ console.dotDotDot();
+ console.printSlow("Natural Roll! Pass Line Wins!\n");
+ currentPlayer.addHistory("You won $" + playerBet + " playing Craps ** " + timeFormatter.format(LocalDateTime.now()));
+ returnWinnings(currentPlayer, playerBet);
+ moneySound.play();
+ return false;
+ } else {
+ console.dotDotDot();
+ console.printSlow("The point is now " + roll + "!\n");
+ puckVal = roll;
+ return true;
+ }
+ }
+
+ private boolean passRoll(Player currentPlayer) {
+ console.printSlow("\nHit Return to Roll the Dice\n");
+ Integer roll = roll();
+ console.printSlow("You Rolled a " + roll + "!\n");
+
+ if (roll.equals(puckVal)) {
+ console.dotDotDot();
+ console.printSlow("You Hit the Point Value!\n");
+ currentPlayer.addHistory("You won $" + playerBet + " playing Craps ** " + timeFormatter.format(LocalDateTime.now()));
+ returnWinnings(currentPlayer, playerBet);
+ moneySound.play();
+ return false;
+ } else if (roll.equals(7)) {
+ console.printSlow("Seven-Out! The Pass Line Losses");
+ console.dotDotDot();
+ console.newln();
+ currentPlayer.addHistory("You lost $" + playerBet + " playing Craps ** " + timeFormatter.format(LocalDateTime.now()));
+ loseSound.play();
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public boolean playAgain() {
+ console.printSlow("Play Again?\n");
+ console.delay(400);
+ console.println("(1) Yes");
+ console.println("(2) No");
+ String input = console.getStringInput(":");
+
+ switch (input) {
+ case "1":
+ return true;
+ case "2":
+ return false;
+ default:
+ console.println("Invalid Input");
+ return playAgain();
+ }
+ }
+
+ @Override
+ public void placeBet(Player currentPlayer) {
+
+ boolean correctVal = false;
+ while (!correctVal) {
+ console.printSlow("How much would you like to bet?\t Balance $" + currentPlayer.getBalance() + "\n");
+ Integer betAmount = console.getIntegerInput("$");
+
+ if (currentPlayer.getBalance() >= betAmount && betAmount >= 0) {
+ currentPlayer.changeBalance(-1 * betAmount);
+ playerBet = betAmount;
+ spendSound.play();
+ correctVal = true;
+ } else {
+ console.printSlow("You don't have that much money");
+ console.dotDotDot();
+ console.delay(1000);
+ correctVal = false;
+ }
+ }
+ }
+
+ @Override
+ public void returnWinnings(Player currentPlayer, Integer playerBet) {
+ console.printSlow("You won $" + playerBet + "\n");
+ currentPlayer.changeBalance(playerBet * 2);
+ console.printSlow("Your balance is now $" + currentPlayer.getBalance() + "\n");
+ console.delay(1000);
+ }
+
+ @Override
+ public void exitGame(Player currentPlayer) {
+
+ }
+
+}
diff --git a/src/main/java/io/zipcoder/casino/Games/GamblingGame.java b/src/main/java/io/zipcoder/casino/Games/GamblingGame.java
new file mode 100644
index 000000000..85ec6bcd5
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/Games/GamblingGame.java
@@ -0,0 +1,11 @@
+package io.zipcoder.casino.Games;
+
+import io.zipcoder.casino.PlayerCreation.Player;
+
+public interface GamblingGame {
+
+ void placeBet(Player currentPlayer);
+ void returnWinnings(Player currentPlayer, Integer bet);
+
+}
+
diff --git a/src/main/java/io/zipcoder/casino/Games/Game.java b/src/main/java/io/zipcoder/casino/Games/Game.java
new file mode 100644
index 000000000..f7d23e2f7
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/Games/Game.java
@@ -0,0 +1,12 @@
+package io.zipcoder.casino.Games;
+
+import io.zipcoder.casino.PlayerCreation.Player;
+
+public interface Game {
+
+ void approachTable(Player currentPLayer);
+ void runGame(Player currentPlayer);
+ void exitGame(Player currentPlayer);
+
+
+}
diff --git a/src/main/java/io/zipcoder/casino/Games/GoFish/GoFish.java b/src/main/java/io/zipcoder/casino/Games/GoFish/GoFish.java
new file mode 100644
index 000000000..4ae73baa5
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/Games/GoFish/GoFish.java
@@ -0,0 +1,318 @@
+package io.zipcoder.casino.Games.GoFish;
+
+import io.zipcoder.casino.GamePieces.Card;
+import io.zipcoder.casino.GamePieces.CardValue;
+import io.zipcoder.casino.GamePieces.Deck;
+import io.zipcoder.casino.Games.Game;
+import io.zipcoder.casino.PlayerCreation.Player;
+import io.zipcoder.casino.utilities.CasinoArt;
+import io.zipcoder.casino.utilities.Console;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Random;
+
+public class GoFish implements Game {
+
+ private DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
+ private Console console = new Console(System.in, System.out);
+ private CasinoArt casinoArt = new CasinoArt();
+ private boolean running = true;
+
+ private Deck deck;
+ private ArrayList playerHand;
+ private ArrayList aiHand;
+ private Integer playerPairs;
+ private Integer aiPairs;
+
+
+ public GoFish() {
+ deck = new Deck();
+
+ playerHand = new ArrayList<>();
+ aiHand = new ArrayList<>();
+
+ playerPairs = 0;
+ aiPairs = 0;
+ }
+
+ @Override
+ public void approachTable(Player currentPLayer) {
+ Console.clearScreen();
+ console.printFast(casinoArt.getCasinoArt(CasinoArt.Art.GOFISH));
+ console.printSlow("\n\nThe stench of smoke, booze, and sweat lifts from the air, replaced by the sweet aroma of sugar.\n" +
+ "Little people crowd around a table that barely reaches your knee caps. And yet, they are playing\n" +
+ "cards, not unlike those seen in Poker.\n\n" +
+ "\"What game is this?\" you ask the most mature of these little folk.\n" +
+ "\"Go Fish,\" he replies, twisting his glasses and swirling his milk in a martini glass.\n\n" +
+ "Then, it suddenly dawns upon you. You are no longer in the casino, but rather... in the kids room.\n\nAnd the game is Go Fish.\n\n");
+ console.dotDotDot();
+ console.newln();
+ console.printSlow("Would you like to play?\n");
+ console.delay(400);
+ console.printSlow("(1) Yes\n");
+ console.printSlow("(2) No\n");
+
+ String input = console.getStringInput(":");
+
+ switch (input) {
+ case "1":
+ runGame(currentPLayer);
+ break;
+ case "2":
+ console.printSlow("Good Idea");
+ console.newln();
+ break;
+ default:
+ console.print("Invalid Input");
+ console.dotDotDot();
+ console.newln();
+ console.delay(2000);
+ approachTable(currentPLayer);
+ break;
+ }
+ }
+
+ @Override
+ public void runGame(Player currentPlayer) {
+
+ deck = new Deck();
+ deck.shuffle();
+ dealHands();
+
+ while (running) {
+ console.print("Your current hand is ");
+ displayHand(playerHand);
+
+ while (aiHand.size() > 0 && playerHand.size() > 0 && deck.cardsLeft() > 0 && checkCard(playerGuess(playerHand), playerHand, aiHand)) {
+ console.printSlow("You guessed right!\n");
+ checkBook(playerHand, true);
+ if(playerHand.size() > 0) {
+ console.print("Your current hand is ");
+ displayHand(playerHand);
+ }
+ }
+
+ if (!deck.cardsLeft().equals(0) && playerHand.size() != 0 && aiHand.size() != 0) {
+ console.printSlow("Wrong guess! Go Fish!\n");
+ console.printSlow("You draw a " + fish(playerHand).getCardValue().toString() + "!\n");
+ checkBook(playerHand, true);
+
+ if(playerHand.size() > 0) {
+ console.printSlow("Your hand is now ");
+ displayHand(playerHand);
+ }
+ console.printSlow("Hit enter to continue\n");
+ console.print("--------------------------------------------------------------");
+ console.println(" You have " + playerHand.size() + " cards and " + playerPairs + " books");
+ console.getStringInput("");
+
+
+ while (aiHand.size() > 0 && playerHand.size() > 0 && deck.cardsLeft() > 0 && checkCard(aiGuess(), aiHand, playerHand)) {
+ console.printSlow("Your opponent guessed right!\n");
+ }
+ }
+
+
+ if (deck.cardsLeft().equals(0) || playerHand.size() == 0 || aiHand.size() == 0) {
+ running = false;
+ } else {
+ console.printSlow("Your opponent guessed wrong. They Go Fish!\n");
+ fish(aiHand);
+ checkBook(aiHand, false);
+ console.printSlow("Hit enter to continue\n");
+ console.print("--------------------------------------------------------------");
+ console.println(" Your opponent has " + aiHand.size() + " cards and " + aiPairs + " books");
+ console.getStringInput("");
+ }
+ }
+
+ checkWinner(currentPlayer);
+ }
+
+ public void displayHand(ArrayList hand) {
+ Collections.sort(hand);
+ for (Card c : hand) {
+ console.print(c.getCardValue().toString() + " ");
+ }
+ console.newln();
+ }
+
+ public void dealHands() {
+ for (int i = 0; i < 5; i++) {
+ playerHand.add(deck.draw());
+ aiHand.add(deck.draw());
+ }
+
+ checkBook(aiHand, false);
+ checkBook(playerHand, true);
+ }
+
+ public ArrayList removeCards(ArrayList hand, CardValue card) {
+ ArrayList toRemove = new ArrayList<>();
+ for (Card c : hand) {
+ if (c.getCardValue().equals(card)) {
+ toRemove.add(c);
+ }
+ }
+
+ for (Card c : toRemove) {
+ hand.remove(c);
+ }
+
+ return toRemove;
+ }
+
+ public boolean hasCard(ArrayList hand, CardValue card) {
+ for (Card c : hand) {
+ if (c.getCardValue().equals(card)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void checkBook(ArrayList cards, boolean isPlayer) {
+ for (int i = 2; i < 15; i++) {
+ CardValue cardVal = CardValue.fromInt(i);
+ int first = -1;
+ int second = -1;
+ int third = -1;
+ int fourth = -1;
+
+ for(int j = 0; j < cards.size(); j++) {
+ if (cards.get(j).getCardValue().equals(cardVal)) {
+ if(first == -1) {
+ first = j;
+ } else if (second == -1){
+ second = j;
+ } else if (third == -1) {
+ third = j;
+ } else {
+ fourth = j;
+ }
+ }
+ }
+
+ if (first != -1 && second != -1 && third != -1 && fourth != -1) {
+ cards.remove(fourth);
+ cards.remove(third);
+ cards.remove(second);
+ cards.remove(first);
+ if(isPlayer) {
+ console.printSlow("You have a book of " + cardVal + "s!\n");
+ playerPairs++;
+ } else {
+ console.printSlow("Your opponent has a book of " + cardVal + "s!\n");
+ aiPairs++;
+ }
+ }
+ }
+ }
+
+ public boolean checkCard(CardValue card, ArrayList destHand, ArrayList askHand) {
+ if(hasCard(askHand, card)) {
+ destHand.addAll(removeCards(askHand, card));
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public Card fish(ArrayList hand) {
+ Card drawnCard = deck.draw();
+ hand.add(drawnCard);
+ return drawnCard;
+ }
+
+ public CardValue aiGuess() {
+ Random random = new Random();
+ Integer guessVal = random.nextInt(aiHand.size());
+ CardValue guess = aiHand.get(guessVal).getCardValue();
+
+ console.printSlow("Your opponent guesses " + guess + "\n");
+
+ return guess;
+ }
+
+ public CardValue playerGuess(ArrayList playerHand) {
+ CardValue theCard = CardValue.TWO;
+ boolean validInput = false;
+
+ while (!validInput) {
+ validInput = true;
+ console.printSlow("Guess a card\n");
+ String cardGuess = console.getStringInput("");
+
+ if (cardGuess.equals("ace")) {
+ theCard = CardValue.ACE;
+ } else if (cardGuess.equals("king")) {
+ theCard = CardValue.KING;
+ } else if (cardGuess.equals("queen")) {
+ theCard = CardValue.QUEEN;
+ } else if (cardGuess.equals("jack")) {
+ theCard = CardValue.JACK;
+ } else {
+ try {
+ Integer numInput = Integer.parseInt(cardGuess);
+ if (numInput > 1 && numInput < 11) {
+ theCard = CardValue.fromInt(numInput);
+ if(!hasCard(playerHand, theCard)) {
+ console.printSlow("That card is not in your hand!\n");
+ validInput = false;
+ }
+ } else {
+ console.printSlow("That is not a card number! ");
+ throw new NumberFormatException();
+ }
+ } catch (NumberFormatException e) {
+ console.printSlow("What?!\n");
+ validInput = false;
+ }
+ }
+ }
+ return theCard;
+ }
+
+ public void checkWinner(Player currentPlayer) {
+ if (playerPairs > aiPairs) {
+ console.printSlow("You won! with " + playerPairs + " books\n");
+ currentPlayer.addHistory("You won playing Go Fish ** " + timeFormatter.format(LocalDateTime.now()));
+ } else if (playerPairs < aiPairs){
+ console.printSlow("You lost!\n");
+ currentPlayer.addHistory("You lost playing Go Fish ** " + timeFormatter.format(LocalDateTime.now()));
+ } else {
+ currentPlayer.addHistory("You got a tie playing Go Fish ** " + timeFormatter.format(LocalDateTime.now()));
+ console.printSlow("It's a tie!\n");
+ }
+
+ console.printSlow("Would you like to play again?\n");
+ console.printSlow("(1) yes\n");
+ console.printSlow("(2) no\n");
+
+ String input = console.getStringInput(":");
+ switch (input) {
+ case "1":
+ runGame(currentPlayer);
+ break;
+ case "2":
+ console.printSlow("Good Idea");
+ console.newln();
+ break;
+ default:
+ console.print("Invalid Input");
+ console.dotDotDot();
+ console.newln();
+ console.delay(2000);
+ approachTable(currentPlayer);
+ break;
+ }
+ }
+
+ @Override
+ public void exitGame(Player currentPlayer) {
+
+ }
+}
diff --git a/src/main/java/io/zipcoder/casino/Games/HighAndLow/HighAndLow.java b/src/main/java/io/zipcoder/casino/Games/HighAndLow/HighAndLow.java
new file mode 100644
index 000000000..499c80931
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/Games/HighAndLow/HighAndLow.java
@@ -0,0 +1,233 @@
+package io.zipcoder.casino.Games.HighAndLow;
+
+import io.zipcoder.casino.utilities.CasinoArt;
+import io.zipcoder.casino.GamePieces.Dice;
+import io.zipcoder.casino.Games.GamblingGame;
+import io.zipcoder.casino.Games.Game;
+import io.zipcoder.casino.PlayerCreation.Player;
+import io.zipcoder.casino.utilities.Console;
+import io.zipcoder.casino.utilities.Sound;
+
+import java.time.format.DateTimeFormatter;
+import java.time.LocalDateTime;
+
+
+public class HighAndLow implements Game, GamblingGame {
+ private Console console = new Console(System.in, System.out);
+ private DateTimeFormatter dateTimeReformatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
+ private Dice dice = new Dice();
+ private Integer totalBetValue = 0;
+ private Player currentPlayer;
+ private HighAndLowLanguage language = new HighAndLowLanguage();
+ private CasinoArt art = new CasinoArt();
+ private boolean running = true;
+ private boolean didYouBet = true;
+ private Sound spendSound;
+ private Sound moneySound;
+ private Sound loseSound;
+ private Sound diceSound;
+ private Sound winSound;
+
+
+ public void runHighOrLow(Player currentPlayer) {
+ spendSound = new Sound("spend_money.wav");
+ moneySound = new Sound("win_money.wav");
+ loseSound = new Sound("wahwah.wav");
+ diceSound = new Sound("dice_roll.wav");
+ winSound = new Sound("win_Sound.wav");
+ this.currentPlayer = currentPlayer;
+ approachTable(currentPlayer);
+ }
+
+ @Override
+ public void approachTable(Player currentPlayer) {
+ Console.clearScreen();
+ console.println(art.getCasinoArt(CasinoArt.Art.HIGHANDLOW));
+ console.println(language.getHighAndLowLanguage(HighAndLowLanguage.Language.APPROACHTABLE));
+ while(running) {
+ console.println(language.getHighAndLowLanguage(HighAndLowLanguage.Language.APPROACHTABLEMENU));
+ Integer playerInput = console.getIntegerInput(":");
+
+ switch (playerInput) {
+ case 1:
+ runGame(currentPlayer);
+ running = false;
+ break;
+ case 2:
+ console.println(showRules());
+ break;
+ case 3:
+ running = false;
+ break;
+ }
+ }
+ }
+
+ public String showRules(){
+ return language.getHighAndLowLanguage(HighAndLowLanguage.Language.RULES);
+ }
+
+ public Boolean resetGame(){
+ didYouBet = true;
+ totalBetValue = 0;
+ return didYouBet;
+ }
+
+ @Override
+ public void placeBet(Player currentPlayer) {
+ currentPlayer.placeBet(10);
+ totalBetValue += 10;
+ }
+
+ public Integer firstRoll(){
+ Integer roll = dice.rollDice(1);
+ console.println(dice.diceArt(roll));
+ Integer roll2 = dice.rollDice(1);
+ console.println(dice.diceArt(roll2));
+ Integer sumOfRolls = roll + roll2;
+ console.println("The first result of the first roll is %d", sumOfRolls);
+ return sumOfRolls;
+ }
+
+ public Boolean secondBet(Integer playerInput){
+ return playerInput == 1;
+ }
+
+ public String highOrLowBet(Integer highOrLow){
+ if(highOrLow == 1){
+ return "high";
+ }
+ return "low";
+ }
+
+ public Integer secondRoll(){
+ Integer roll = dice.rollDice(1);
+ console.println(dice.diceArt(roll));
+ Integer roll2 = dice.rollDice(1);
+ console.println(dice.diceArt(roll2));
+ Integer sumOfRolls = roll + roll2;
+ console.println("The result of the second roll is %d", sumOfRolls);
+ return sumOfRolls;
+ }
+
+ public String noBet(Integer totalBetValue){
+ console.println("Backing out? No problem! You've lost $%d.00", totalBetValue);
+ return String.format("You lost $%d.00 at High and Low. ** ", totalBetValue);
+ }
+
+ public void playWinOrLoseSound(Integer firstRoll, Integer secondRoll, String highOrLowBet){
+ if((firstRoll > secondRoll && highOrLowBet.equals("low")) || (firstRoll < secondRoll && highOrLowBet.equals("high"))){
+ winSound.play();
+ } else {
+ loseSound.play();
+ }
+ }
+
+ public boolean winOrLose(Integer firstRoll, Integer secondRoll, String highOrLowBet){
+ if((firstRoll > secondRoll && highOrLowBet.equals("low")) || (firstRoll < secondRoll && highOrLowBet.equals("high"))){
+ console.println("Congratulations! You've won $%d.00!", totalBetValue);
+ return true;
+ } else {
+ console.println("Sorry, you've lost $%d.00. Please try again soon!", totalBetValue);
+ return false;
+ }
+ }
+
+ public boolean enoughBalance(Integer currentBalance){
+ return currentBalance >= 10;
+ }
+
+ public void addHistory(Boolean result, Integer totalBetValue, Player currentPlayer){
+ LocalDateTime now = LocalDateTime.now();
+ if(result){
+ String addHistory = String.format("You won $%d.00 at High and Low! ** ", totalBetValue);
+ currentPlayer.addHistory(addHistory + dateTimeReformatter.format(now));
+ } else {
+ String addHistory = String.format("You lost $%d.00 at High and Low. ** ", totalBetValue);
+ currentPlayer.addHistory(addHistory + dateTimeReformatter.format(now));
+ }
+ }
+
+ public String notEnoughMoney() {
+ console.printSlow(language.getHighAndLowLanguage(HighAndLowLanguage.Language.NOTENOUGHMONEY));
+ console.println("Press Enter to return to the game menu... and hopefully the parking lot\n");
+ console.newln();
+ console.dotDotDot();
+ return "Loser";
+ }
+
+ @Override
+ public void returnWinnings(Player currentPlayer, Integer totalBetValue) {
+ currentPlayer.changeBalance(totalBetValue);
+ }
+
+ @Override
+ public void exitGame(Player currentPlayer) {
+ console.println(language.getHighAndLowLanguage(HighAndLowLanguage.Language.PLAYAGAIN));
+ Integer playerInput = console.getIntegerInput(":");
+ switch (playerInput){
+ case 1:
+ runGame(currentPlayer);
+ break;
+ case 2:
+ running = false;
+ break;
+ }
+ }
+
+ @Override
+ public void runGame(Player currentPlayer) {
+ while(running) {
+ if(!enoughBalance(currentPlayer.getBalance())){
+ String brokePunk = notEnoughMoney();
+ console.getStringInput(brokePunk);
+ break;
+ }
+ resetGame();
+ console.println("Welcome to High and Low, %s!\n", currentPlayer.getName());
+ console.printSlow(language.getHighAndLowLanguage(HighAndLowLanguage.Language.BUYIN));
+ //
+ spendSound.play();
+ console.dotDotDot();
+ console.newln();
+ //
+ placeBet(currentPlayer);
+ diceSound.play();
+ Integer firstRoll = firstRoll();
+
+ console.println("Your current balance is $%d.00", currentPlayer.getBalance());
+ console.println(language.getHighAndLowLanguage(HighAndLowLanguage.Language.PLACESECONDBET));
+
+ Integer playerInput = console.getIntegerInput(":");
+ didYouBet = secondBet(playerInput);
+ if(didYouBet){
+ spendSound.play();
+ placeBet(currentPlayer);
+ }else {
+ String noBetHistory = noBet(totalBetValue);
+ LocalDateTime now = LocalDateTime.now();
+ currentPlayer.addHistory(noBetHistory + dateTimeReformatter.format(now));
+ exitGame(currentPlayer);
+ break;
+ }
+ console.println(language.getHighAndLowLanguage(HighAndLowLanguage.Language.HIGHORLOW));
+ Integer playerBet = console.getIntegerInput(":");
+ String highOrLowBet = highOrLowBet(playerBet);
+ console.dotDotDot();
+ console.newln();
+
+ diceSound.play();
+ Integer secondRoll = secondRoll();
+
+ playWinOrLoseSound(firstRoll, secondRoll, highOrLowBet);
+ Boolean result = winOrLose(firstRoll, secondRoll, highOrLowBet);
+ if(result){
+ returnWinnings(currentPlayer, totalBetValue * 2);
+ }
+ addHistory(result, totalBetValue, currentPlayer);
+
+ console.println("Your current balance is $%d.00", currentPlayer.getBalance());
+ exitGame(currentPlayer);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/io/zipcoder/casino/Games/HighAndLow/HighAndLowLanguage.java b/src/main/java/io/zipcoder/casino/Games/HighAndLow/HighAndLowLanguage.java
new file mode 100644
index 000000000..224b91d36
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/Games/HighAndLow/HighAndLowLanguage.java
@@ -0,0 +1,47 @@
+package io.zipcoder.casino.Games.HighAndLow;
+
+import java.util.HashMap;
+
+public class HighAndLowLanguage {
+
+ HashMap highAndLowHashMap = new HashMap<>();
+
+ public enum Language{
+ APPROACHTABLE, RULES,APPROACHTABLEMENU,PLAYAGAIN,HIGHORLOW,LOSE,DIDNOTBET2,BUYIN,PLACESECONDBET,NOTENOUGHMONEY;
+ }
+
+ public String getHighAndLowLanguage(Language key) {
+ return highAndLowHashMap.get(key);
+ }
+
+ public HighAndLowLanguage(){
+ this.highAndLowHashMap.put(Language.APPROACHTABLE, "The High and Low table... reputed as the lowest of casino games.\n" +
+ "Diminishing returns for the despairing and unfortunate who have fallen too hard on their bad luck.\n" +
+ "Desperation permeates from the eyes of those gathered around the moldy table,\n" +
+ "gravely placing their hopes to win back ANYTHING from their losses in this last-ditch game of chance.\n" +
+ "Have they really sunk that low to be playing this game?\n" +
+ "\"Have I?\" you think to yourself as you approach the table.\n\nWhat would you like to do?\n\n");
+ this.highAndLowHashMap.put(Language.RULES,"\n\nA simple game for meager winnings. At High and Low,\n" +
+ "you'll only be able to but in at $10. Simply roll two dice, and our pit boss will\n" +
+ "present to you the sum of the rolls and the chance to bet $10 more on High or Low.\n" +
+ "If you believe the sum of the second roll will be higher, bet high.\n" +
+ "Likewise, if you believe the sum of the second roll will be lower, bet low.\n");
+ this.highAndLowHashMap.put(Language.NOTENOUGHMONEY, "The pit boss glares are you, seemingly knowing you don't have enough money\n" +
+ "to pay even the buy-in cost.\nHe shakes his head, branding his red stick in hand with a menacing grasp.\n" +
+ "Perhaps it's best if you accept your losses and drag your sorry self home.\nTomorrow is a new day... maybe.\n\n");
+
+
+ this.highAndLowHashMap.put(Language.APPROACHTABLEMENU, "(1) - Play the game\n(2) - Read the rules\n(3) - Return to the game menu");
+ this.highAndLowHashMap.put(Language.BUYIN,"Sitting at the table, you commit yourself to a $10 bet. Too late to back out now!");
+ this.highAndLowHashMap.put(Language.PLAYAGAIN, "Would you like to play again?\n(1) - Yes\n(2) - No");
+ this.highAndLowHashMap.put(Language.HIGHORLOW, "Do you want to bet High or Low?\n(1) - High\n(2) - Low");
+ this.highAndLowHashMap.put(Language.LOSE, "Sorry, you've lost. Try again soon!");
+ this.highAndLowHashMap.put(Language.DIDNOTBET2, "No bets? Okay, all fun and games here.\nWe'll still let you pick.");
+ this.highAndLowHashMap.put(Language.PLACESECONDBET, "Now, you will be asked to bet on High or Low.\nWould you like to bet $10 again?\n(1) - Yes, bet $10\n(2) - Nope, I'm out.");
+
+ }
+
+
+
+}
+
diff --git a/src/main/java/io/zipcoder/casino/Games/Roulette/Roulette.java b/src/main/java/io/zipcoder/casino/Games/Roulette/Roulette.java
new file mode 100644
index 000000000..82b02546f
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/Games/Roulette/Roulette.java
@@ -0,0 +1,234 @@
+package io.zipcoder.casino.Games.Roulette;
+
+import io.zipcoder.casino.Games.GamblingGame;
+import io.zipcoder.casino.Games.Game;
+import io.zipcoder.casino.Menus.Casino;
+import io.zipcoder.casino.utilities.CasinoArt;
+import io.zipcoder.casino.GamePieces.RouletteSpinner;
+import io.zipcoder.casino.PlayerCreation.Player;
+import io.zipcoder.casino.utilities.Console;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+public class Roulette implements Game, GamblingGame {
+ // Casino casino = new Casino();
+ Console console = new Console(System.in, System.out);
+ Player currentPlayer;
+ private DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
+ private boolean running = true;
+ private boolean currentGame = true;
+ private Integer pot;
+ private Integer multiplier;
+ private Integer spinNum;
+ private Integer placeBetInt;
+ private boolean isWinner;
+ private Boolean isOddEvenGame;
+ private Integer totalReturns;
+ private CasinoArt art = new CasinoArt();
+
+ public void runRoulette(Player currentPlayer){
+ this.currentPlayer = currentPlayer;
+ approachTable(currentPlayer);
+ }
+
+ public void approachTable(Player currentPlayer) {
+ Console.clearScreen();
+
+ console.println(art.getCasinoArt(CasinoArt.Art.ROULETTE));
+ console.println("You approach the Roulette. What would you like to do?");
+ console.println("(1) - Play the game");
+ console.println("(2) - Return to the game menu");
+ Integer playerInput = console.getIntegerInput(":");
+ while (playerInput < 1 || playerInput >2) {
+ console.println("Please pick option 1 or 2 dumbass");
+ playerInput = console.getIntegerInput(":");
+ }
+ while (running) {
+
+ switch (playerInput) {
+ case 1:
+ runGame(currentPlayer);
+ running = false;
+ break;
+ case 2:
+
+ running = false;
+ break;
+ }
+ }
+ }
+
+
+ @Override
+ public void runGame(Player currentPlayer){
+ while (running){
+ placeBet(currentPlayer);
+ playersPick(currentPlayer);
+ winningNumber();
+ if(isWinner()){
+ returnWinnings(currentPlayer, totalReturns);
+ }else {
+ youLose(currentPlayer);
+ }
+ exitGame(currentPlayer);
+
+ }
+ //prompting player to place bet
+ // prompting to pick number
+ //call spinner to generate winning number
+ // if player number == winning number
+ // return winnings
+ }
+
+ @Override
+ public void exitGame(Player currentPlayer) {
+ console.println("Would you like to play again?");
+ console.println("(1) - Yes");
+ console.println("(2) - No");
+ Integer playerInput = console.getIntegerInput(":");
+ while (playerInput < 1 || playerInput >2){
+ console.println("Please pick option 1 or 2 dumbass");
+ playerInput = console.getIntegerInput(":");
+ }
+ switch (playerInput) {
+ case 1:
+ runGame(currentPlayer);
+ break;
+ case 2:
+// casino.goToGameMenu();
+ running = false;
+ break;
+ }
+ }
+
+ @Override
+ public void placeBet(Player currentPlayer) {
+ console.println("How much would you like to bet?");
+ pot = console.getIntegerInput(":");
+
+ }
+
+ public void playersPick(Player currentPlayer) {
+ console.println("Where are you betting? Pick an option");
+ console.println(("(1) - Would you like to pick a number?"));
+ console.println("(2) - Pick Odd or Even");
+ Integer playerInput = console.getIntegerInput(":");
+ while (playerInput < 1 || playerInput > 2 ){
+ console.println("Please pick option 1 or 2 dumbass");
+ playerInput = console.getIntegerInput(":");
+ }
+ switch (playerInput) {
+ case 1:
+ playerBetInt(playerInput);
+ break;
+ case 2:
+ playerBetOddEven(playerInput);
+ break;
+
+
+ }
+
+ }
+
+ public Integer playerBetInt(Integer playerInput) {
+ isOddEvenGame = false;
+ console.println("Pick a number 0 - 36");
+ Integer playerBet = console.getIntegerInput(":");
+ if (playerBet < 0 || playerBet > 36) {
+ console.println("Try again! Pick a number 0 - 36");
+ playerBet = console.getIntegerInput(":");
+ }
+ placeBetInt = playerBet;
+ multiplier = 6;
+ return playerBet;
+ }
+
+ public void playerBetOddEven(Integer playerInput) {
+ isOddEvenGame = true;
+ console.println("Odds or Even?");
+ console.println("(1) - Odd");
+ console.println("(2) - Even");
+ Integer playerBet = console.getIntegerInput(":");
+ if (!(playerBet == 1 || playerBet == 2)) {
+ console.println("Try again!");
+ console.getIntegerInput(":");
+ } else if (playerBet == 1) {
+ placeBetInt = 1;
+ } else if (playerBet == 2) {
+ placeBetInt = 0;
+
+
+ }
+ multiplier = 2;
+ }
+
+ public Integer winningNumber (){
+ spinNum = RouletteSpinner.winningNumber();
+ console.println(spinNum.toString());
+ return spinNum;
+ }
+
+ public boolean isWinner(){
+ if(isOddEvenGame) {
+ return spinNum % 2 == placeBetInt;
+ }
+ return spinNum.equals(placeBetInt);
+ }
+
+ // If we can I would like to find a way to return a higher odds for betting "number" vs. "odd/even"
+ @Override
+ public void returnWinnings(Player currentPlayer, Integer winnings) {
+ if (isWinner()) {
+ totalReturns = pot * multiplier;
+ console.println("Congrats maybe you don't suck I'll give you $"+ totalReturns);
+ //Need to change "totalReturns in line 172 to reflect player balance
+ currentPlayer.changeBalance(totalReturns);
+ console.println("Your new balance is : $" + currentPlayer.getBalance());
+ LocalDateTime now = LocalDateTime.now();
+ String addHistory = String.format("You won $%d.00 at Roulette! ** ", totalReturns);
+ currentPlayer.addHistory(addHistory + dtf.format(now));
+
+ }
+
+ }
+
+ public boolean youLose(Player currentPlayer) {
+ totalReturns = -pot;
+ console.println("You suck and you should feel bad. You lost: $" + totalReturns);
+ currentPlayer.changeBalance(totalReturns);
+ console.println("Your new balance is : $" + currentPlayer.getBalance());
+ LocalDateTime now = LocalDateTime.now();
+ String addHistory = String.format("You lost $%d.00 at Roulette! ** ", totalReturns);
+ currentPlayer.addHistory(addHistory + dtf.format(now));
+ return true;
+ }
+
+ public void setPot(Integer pot) {
+ this.pot = pot;
+ }
+
+ public void setMultiplier(Integer multiplier) {
+ this.multiplier = multiplier;
+ }
+
+ public void setSpinNum(Integer spinNum) {
+ this.spinNum = spinNum;
+ }
+ public void setTotalReturns(Integer totalReturns){
+ this.totalReturns = totalReturns;
+ }
+
+ public void setPlaceBetInt(Integer placeBetInt) {
+ this.placeBetInt = placeBetInt;
+ }
+ public void setOddEvenGame(Boolean oddEvenGame) {
+ isOddEvenGame = oddEvenGame;
+ }
+ public Player getCurrentPlayer() {
+ return currentPlayer;
+ }
+}
+
+
+
diff --git a/src/main/java/io/zipcoder/casino/Games/Slots/Slots.java b/src/main/java/io/zipcoder/casino/Games/Slots/Slots.java
new file mode 100644
index 000000000..1a422702d
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/Games/Slots/Slots.java
@@ -0,0 +1,185 @@
+package io.zipcoder.casino.Games.Slots;
+
+import io.zipcoder.casino.utilities.CasinoArt;
+import io.zipcoder.casino.GamePieces.SlotMachine;
+import io.zipcoder.casino.Games.GamblingGame;
+import io.zipcoder.casino.Games.Game;
+import io.zipcoder.casino.Menus.Casino;
+import io.zipcoder.casino.PlayerCreation.Player;
+import io.zipcoder.casino.utilities.Console;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+public class Slots implements Game, GamblingGame {
+
+ Console console = new Console(System.in, System.out);
+ Casino casino = new Casino();
+ private Integer[][] slots;
+ SlotMachine slotMachine = new SlotMachine(slots = new Integer[3][3]);
+ Player currentPlayer;
+ private DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
+ private CasinoArt art = new CasinoArt();
+ private Boolean running = true;
+ private Boolean currentGame = true;
+ private Integer pot;
+ private Integer placeBet;
+ private Integer winnings;
+
+
+ @Override
+ public void approachTable(Player currentPLayer) {
+ Console.clearScreen();
+ console.println(art.getCasinoArt(CasinoArt.Art.SLOTS));
+ console.println("You approach the Slot Machine. What would you like to do?");
+ console.println("(1) - Play the game");
+ console.println("(2) - Return to the game menu");
+ Integer playerInput = console.getIntegerInput(":");
+ while (playerInput < 1 || playerInput >2) {
+ console.println("Please pick option 1 or 2 dumbass");
+ playerInput = console.getIntegerInput(":");
+ }
+ while (running) {
+ switch (playerInput) {
+ case 1:
+ runGame(currentPlayer);
+ running = false;
+ break;
+ case 2:
+ running = false;
+ break;
+ }
+ }
+ }
+
+ public void runSlots(Player currentPlayer){
+ this.currentPlayer = currentPlayer;
+ approachTable(currentPlayer);
+ }
+
+ public void runGame(Player currentPlayer){
+ while (running){
+ placeBet(currentPlayer);
+ Integer[][] slotResult = pullLever();
+ if(isWinner(slotResult)){
+ returnWinnings(currentPlayer);
+ } else {
+ youLose(currentPlayer);
+ }
+ exitGame(currentPlayer);
+ }
+ }
+
+ public void exitGame(Player currentPlayer){
+ console.println("Would you like to play again?");
+ console.println("(1) - Yes");
+ console.println("(2) - No");
+ Integer playerInput = console.getIntegerInput(":");
+ while (playerInput < 1 || playerInput >2) {
+ console.println("Please pick option 1 or 2 dumbass");
+ playerInput = console.getIntegerInput(":");
+ }
+
+ switch (playerInput) {
+ case 1:
+ runGame(currentPlayer);
+ break;
+ case 2:
+ //casino.goToGameMenu();
+ running = false;
+ break;
+ }
+
+ }
+ public void placeBet(Player currentPlayer){
+ console.println("How much would you like to bet?");
+ pot = console.getIntegerInput(":");
+ }
+
+ @Override
+ public void returnWinnings(Player currentPlayer, Integer bet) {
+
+ }
+
+ public Integer[][] pullLever(){
+
+ slots = slotMachine.createMachine();
+ for(int i = 0; i < slots.length; i++){
+ for(int j = 0; j snakesMap = new HashMap<>();
+ HashMap laddersMap = new HashMap<>();
+
+ snakesMap.put(16, 6);
+ snakesMap.put(46, 26);
+ snakesMap.put(49, 11);
+ snakesMap.put(56, 53);
+ snakesMap.put(62, 19);
+ snakesMap.put(64, 60);
+ snakesMap.put(87, 24);
+ snakesMap.put(93, 73);
+ snakesMap.put(95, 75);
+ snakesMap.put(98, 78);
+
+ laddersMap.put(1, 38);
+ laddersMap.put(4, 14);
+ laddersMap.put(9, 31);
+ laddersMap.put(21, 42);
+ laddersMap.put(28, 84);
+ laddersMap.put(36, 44);
+ laddersMap.put(51, 67);
+ laddersMap.put(71, 91);
+ laddersMap.put(80, 99);
+
+ if (laddersMap.containsKey(position)) {
+ newPosition = laddersMap.get(position);
+ } else if (snakesMap.containsKey(position)) {
+ newPosition = snakesMap.get(position);
+ } else {
+ newPosition = position;
+ }
+ return newPosition;
+ }
+
+
+ public void playSound (Integer position){
+ Integer newPosition = snakesAndLaddersCheckerViaMap(position);
+ if (position > newPosition) {
+ snakeSound.play();
+ } else if (position < newPosition) {
+ ladderSound.play();
+ }
+ }
+
+ public Integer snakesAndLaddersCheck (Integer position,boolean isPlayer){
+ Integer newPosition = snakesAndLaddersCheckerViaMap(position);
+ if (position > newPosition) {
+ if (isPlayer) {
+ console.println("Uh-oh! You've hit a Snake! You're back at %d", newPosition);
+ playerPiece.setCurrentPosition(newPosition);
+ } else {
+ console.println("Uh-oh! I've hit a Snake! I'm back at %d", newPosition);
+ aiPiece.setCurrentPosition(newPosition);
+ }
+ return newPosition;
+ } else if (position < newPosition) {
+ if (isPlayer) {
+ console.println("Hooray! You've hit a Ladder! You're now at %d.", newPosition);
+ playerPiece.setCurrentPosition(newPosition);
+ } else {
+ console.println("Hooray! I've hit a Ladder! I'm now at %d.", newPosition);
+ aiPiece.setCurrentPosition(newPosition);
+ }
+ return newPosition;
+ }
+ return position;
+ }
+
+ public String testIfWon (Integer playerPosition, Boolean isPlayer){
+ if (playerPosition >= 100 && isPlayer) {
+ return "Player";
+ } else if (playerPosition >= 100 & !isPlayer) {
+ return "Ai";
+ }
+ return "no winner yet";
+ }
+
+ @Override
+ public void exitGame (Player currentPlayer){
+ console.println(text.getSnakeLanguage(SnakesAndLaddersLanguage.Language.EXITMENU));
+ Integer playerInput = console.getIntegerInput(":");
+ switch (playerInput) {
+ case 1:
+ runGame(currentPlayer);
+ break;
+ case 2:
+ running = false;
+ break;
+ }
+ }
+ }
diff --git a/src/main/java/io/zipcoder/casino/Games/SnakesAndLadders/SnakesAndLaddersLanguage.java b/src/main/java/io/zipcoder/casino/Games/SnakesAndLadders/SnakesAndLaddersLanguage.java
new file mode 100644
index 000000000..e3e83c33a
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/Games/SnakesAndLadders/SnakesAndLaddersLanguage.java
@@ -0,0 +1,40 @@
+package io.zipcoder.casino.Games.SnakesAndLadders;
+
+import java.util.HashMap;
+
+public class SnakesAndLaddersLanguage {
+ HashMap snakesHashMap = new HashMap<>();
+
+ public enum Language {
+ RULES,APPROACHTABLE,WELCOME,EXITMENU,DICEROLL,PLAYERWINS,AIWINS;
+ }
+
+ public String getSnakeLanguage(Language key) {
+ return snakesHashMap.get(key);
+ }
+
+ public SnakesAndLaddersLanguage(){
+ snakesHashMap.put(Language.RULES, "Snakes and Ladders finds its origins in Ancient India, where it\n" +
+ "was first created under the name Moksha Patam.\n" +
+ "It was used to teach children values, rewarding proper behavior with\n" +
+ "a boost in point value, via climbing a ladder, or punishing a player\n" +
+ "in point value for bad behavior, via sliding down the back of a snake.\n\n" +
+ "Commercially known in the West as Chutes and Ladders, the game has been published by Milton Bradley\n" +
+ "since the 1940's, and players compete by rolling dice and\n" +
+ "and racing to the value of 100 points, the final spot on the board.\n" +
+ "But beware! Certain spots on the board will send you down the backs of the Snakes!\n" +
+ "Likewise, certain spots on the board will push you closer to your goal.\n" +
+ "Roll the dice and see who gets there first!\n\n");
+ snakesHashMap.put(Language.APPROACHTABLE, "You approach the Snakes and Ladders table. What would you like to do?\n" +
+ "(1) - Play the game\n" +
+ "(2) - Read the rules\n" +
+ "(3) - Return to the game menu");
+ snakesHashMap.put(Language.WELCOME, "Welcome to Snakes and Ladders, %s!\n" +
+ "In this house, the player always goes first! Step on up!");
+ snakesHashMap.put(Language.EXITMENU, "Would you like to play again?\n(1) - Yes\n(2) - No");
+ snakesHashMap.put(Language.DICEROLL, "Press Enter to roll the dice.");
+ snakesHashMap.put(Language.PLAYERWINS, "Congratulations! You won!");
+ snakesHashMap.put(Language.AIWINS, "Oh, Too bad! I won! Better lucky next time!");
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/io/zipcoder/casino/Menus/Casino.java b/src/main/java/io/zipcoder/casino/Menus/Casino.java
new file mode 100644
index 000000000..352e07ad1
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/Menus/Casino.java
@@ -0,0 +1,50 @@
+package io.zipcoder.casino.Menus;
+
+import io.zipcoder.casino.utilities.CasinoArt;
+import io.zipcoder.casino.PlayerCreation.Player;
+import io.zipcoder.casino.utilities.Console;
+
+public class Casino {
+ private Player currentPlayer;
+ private Console console = new Console(System.in, System.out);
+ private CasinoArt art = new CasinoArt();
+ private boolean running = true;
+
+ public void runCasinoMenu(Player currentPlayer){
+ this.currentPlayer = currentPlayer;
+ while(running) {
+ Console.clearScreen();
+ console.println(art.getCasinoArt(CasinoArt.Art.CASINOLOBBY));
+ System.out.println(String.format("Welcome to The Notorious B.I.G. 3 Casino, %s!", currentPlayer.getName()));
+ Console.displayCasinoMenu();
+ Integer playerInput = console.getIntegerInput(":");
+ casinoMenuLogic(playerInput);
+ }
+ }
+
+ public void casinoMenuLogic(Integer playerInput){
+ switch (playerInput){
+ case 1:
+ GameMenu gameMenu = new GameMenu();
+ gameMenu.runGameMenu(currentPlayer);
+ break;
+ case 2:
+ console.println(String.format("Your current balance is $%d.00.\n\n", currentPlayer.getBalance()));
+ console.getStringInput("Press Enter to return to menu");
+ break;
+ case 3:
+ if(currentPlayer.getHistory().isEmpty()){
+ console.println("Sorry! You do not yet have a gaming history. Play some games to get one!\n\n");
+ console.getStringInput("Press Enter to return to menu");
+ } else {
+ console.println(currentPlayer.printHistory());
+ console.getStringInput("Press Enter to return to menu");
+ }
+ break;
+ case 4:
+ console.println("Thank you for visiting The Notorious B.I.G. 3!");
+ running = false;
+ break;
+ }
+ }
+}
diff --git a/src/main/java/io/zipcoder/casino/Menus/GameMenu.java b/src/main/java/io/zipcoder/casino/Menus/GameMenu.java
new file mode 100644
index 000000000..d2fedcc72
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/Menus/GameMenu.java
@@ -0,0 +1,71 @@
+package io.zipcoder.casino.Menus;
+
+
+import io.zipcoder.casino.Games.SnakesAndLadders.SnakesAndLadders;
+import io.zipcoder.casino.utilities.CasinoArt;
+import io.zipcoder.casino.Games.Blackjack.BlackJack;
+import io.zipcoder.casino.Games.Craps.Craps;
+import io.zipcoder.casino.Games.GoFish.GoFish;
+import io.zipcoder.casino.Games.Roulette.Roulette;
+import io.zipcoder.casino.Games.HighAndLow.HighAndLow;
+import io.zipcoder.casino.PlayerCreation.Player;
+import io.zipcoder.casino.Games.Slots.Slots;
+import io.zipcoder.casino.utilities.Console;
+
+public class GameMenu {
+ private Console console = new Console(System.in, System.out);
+ private Player currentPlayer;
+ private CasinoArt art = new CasinoArt();
+ private boolean running = true;
+
+ public void runGameMenu(Player currentPlayer){
+ this.currentPlayer = currentPlayer;
+ while(running) {
+ Console.clearScreen();
+ console.println(art.getCasinoArt(CasinoArt.Art.GAMEMENU));
+ Console.displayGameMenu();
+ Integer playerInput = console.getIntegerInput(":");
+ gameMenuLogic(playerInput);
+ }
+ }
+
+ public String gameMenuLogic(Integer playerInput){
+ switch (playerInput) {
+ case 1:
+ GoFish goFish = new GoFish();
+ goFish.approachTable(currentPlayer);
+ break;
+ case 2:
+
+ BlackJack blackjack = new BlackJack();
+ blackjack.runBlackJack(currentPlayer);
+ break;
+ case 3:
+ Craps craps = new Craps();
+ craps.approachTable(currentPlayer);
+ return "You would be playing craps now.";
+ case 4:
+ SnakesAndLadders SnakesAndLadders = new SnakesAndLadders();
+ SnakesAndLadders.runSnakesAndLadders(currentPlayer);
+ return "You would be playing Snakes and Ladders now.";
+ case 5:
+ Roulette roulette = new Roulette();
+ roulette.runRoulette(currentPlayer);
+ return "You would be playing Roulette now.";
+ case 6:
+
+ Slots slots = new Slots();
+ slots.runSlots(currentPlayer);
+ return "You would be playing Slots now";
+ case 7:
+ HighAndLow highAndLow = new HighAndLow();
+ highAndLow.runHighOrLow(currentPlayer);
+ return "You would be playing High and Low now.";
+ case 8:
+ running = false;
+ break;
+ }
+ return null;
+ }
+}
+
diff --git a/src/main/java/io/zipcoder/casino/PlayerCreation/Player.java b/src/main/java/io/zipcoder/casino/PlayerCreation/Player.java
new file mode 100644
index 000000000..7ea611138
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/PlayerCreation/Player.java
@@ -0,0 +1,55 @@
+package io.zipcoder.casino.PlayerCreation;
+
+import io.zipcoder.casino.utilities.Console;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Player {
+
+ private String name;
+ private Integer balance;
+ private ArrayList gameHistory;
+ Console console = new Console(System.in, System.out);
+
+ public Player(String name, Integer initialBalance) {
+ this.name = name;
+ this.balance = initialBalance;
+ this.gameHistory = new ArrayList<>();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Integer getBalance() {
+ return balance;
+ }
+
+ public void placeBet(Integer amount) {
+ this.balance -= amount;
+ }
+
+ public void changeBalance(Integer amount) {
+ this.balance += amount;
+ }
+
+ public ArrayList getHistory() {
+ return gameHistory;
+ }
+
+ public void addHistory(String results) {
+ gameHistory.add(results);
+ }
+
+ public String printHistory() {
+ StringBuilder sb = new StringBuilder();
+ Integer historyCounter = 0;
+ for(String history : gameHistory){
+ sb.append(gameHistory.get(historyCounter));
+ sb.append("\n");
+ historyCounter++;
+ }
+ return sb.toString();
+ }
+}
diff --git a/src/main/java/io/zipcoder/casino/PlayerMenu.java b/src/main/java/io/zipcoder/casino/PlayerMenu.java
new file mode 100644
index 000000000..4f061606e
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/PlayerMenu.java
@@ -0,0 +1,90 @@
+package io.zipcoder.casino;
+
+import io.zipcoder.casino.utilities.CasinoArt;
+import io.zipcoder.casino.Menus.Casino;
+import io.zipcoder.casino.PlayerCreation.Player;
+import io.zipcoder.casino.utilities.Console;
+
+public class PlayerMenu {
+ Console console = new Console(System.in,System.out);
+ private PlayerRepository playerRepo;
+ private CasinoArt art = new CasinoArt();
+ boolean running;
+
+ public PlayerMenu() {
+ playerRepo = new PlayerRepository();
+ running = true;
+
+ playerRepo.addPlayer(new Player("Test", 500));
+ }
+
+ public void runPlayerMenu( ){
+ while (running) {
+ Console.clearScreen();
+ console.println(art.getCasinoArt(CasinoArt.Art.PLAYERMENU));
+ Console.displayPlayerMenu();
+ Integer playerInput = getPlayerInput();
+ playerMenuLogic(playerInput);
+ }
+ }
+
+ private Integer getPlayerInput(){
+ return console.getIntegerInput(":");
+ }
+
+ private Player loadPlayer() {
+ console.println("Please enter your name.");
+ String playerName = console.getStringInput(":");
+ return playerRepo.findPlayer(playerName);
+ }
+
+ private Player createPlayer() {
+ console.println("Please enter your name.");
+ String playerName = console.getStringInput(":");
+ Player newPlayer = new Player(playerName, 500);
+
+ if(playerRepo.addPlayer(newPlayer)) {
+ return newPlayer;
+ } else {
+ return null;
+ }
+ }
+
+
+
+ public void playerMenuLogic(Integer playerInput){
+ Casino casino = new Casino();
+ Player player = null;
+
+ switch (playerInput) {
+ case 1:
+
+ player = loadPlayer();
+ if (player != null) {
+ casino.runCasinoMenu(player);
+ } else {
+ console.println("I don't know you!\n\n");
+ console.getStringInput("Press Enter to return to menu");
+ }
+ break;
+ case 2:
+
+ player = createPlayer();
+ if (player != null) {
+ casino.runCasinoMenu(player);
+ } else {
+ console.println("That User Already Exists");
+ }
+
+ break;
+ case 3:
+ console.println("thank you come again!");
+ running = false;
+ break;
+ default:
+ console.print("Invalid Input");
+ break;
+ }
+ }
+
+}
diff --git a/src/main/java/io/zipcoder/casino/PlayerRepository.java b/src/main/java/io/zipcoder/casino/PlayerRepository.java
new file mode 100644
index 000000000..15f884024
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/PlayerRepository.java
@@ -0,0 +1,28 @@
+package io.zipcoder.casino;
+
+import io.zipcoder.casino.PlayerCreation.Player;
+
+import java.util.HashMap;
+
+public class PlayerRepository {
+
+ HashMap playerDataBase;
+
+ public PlayerRepository() {
+ playerDataBase = new HashMap<>();
+ }
+
+ Player findPlayer(String playerName) {
+ return playerDataBase.get(playerName);
+ }
+
+ boolean addPlayer(Player player) {
+ if(playerDataBase.containsKey(player.getName())) {
+ return false;
+ } else {
+ playerDataBase.put(player.getName(), player);
+ return true;
+ }
+ }
+
+}
diff --git a/src/main/java/io/zipcoder/casino/utilities/CasinoArt.java b/src/main/java/io/zipcoder/casino/utilities/CasinoArt.java
new file mode 100644
index 000000000..e12bd92b8
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/utilities/CasinoArt.java
@@ -0,0 +1,161 @@
+package io.zipcoder.casino.utilities;
+
+import java.util.HashMap;
+
+public class CasinoArt {
+ private HashMap casinoArtHashMap = new HashMap<>();
+
+
+ public enum Art {
+ SNAKESANDLADDERS, GAMEMENU, CASINOLOBBY, PLAYERMENU, ROULETTE, HIGHANDLOW, CRAPS, BLACKJACK, SLOTS, GOFISH;
+ }
+
+ public String getCasinoArt(Art key) {
+ return casinoArtHashMap.get(key);
+ }
+
+ public CasinoArt() {
+ casinoArtHashMap.put(Art.SNAKESANDLADDERS, " _________ __ .___ .____ .___ .___ \n" +
+ " / _____/ ____ _____ | | __ ____ ______ _____ ____ __| _/ | | _____ __| _/__| _/___________ ______\n" +
+ " \\_____ \\ / \\\\__ \\ | |/ // __ \\ / ___/ \\__ \\ / \\ / __ | | | \\__ \\ / __ |/ __ |/ __ \\_ __ \\/ ___/\n" +
+ " / \\ | \\/ __ \\| <\\ ___/ \\___ \\ / __ \\| | \\/ /_/ | | |___ / __ \\_/ /_/ / /_/ \\ ___/| | \\/\\___ \\ \n" +
+ "/_______ /___| (____ /__|_ \\\\___ >____ > (____ /___| /\\____ | |_______ (____ /\\____ \\____ |\\___ >__| /____ >\n" +
+ " \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \n\n\n" +
+ " ---_ ......._-_--.\n" +
+ " (|\\ / / /| \\ \\\n" +
+ " / / .' -=-' `.\n" +
+ " / / .' )\n" +
+ " _/ / .' _.) /\n" +
+ " / o o _.-' / .'\n" +
+ " \\ _.-' / .'*|\n" +
+ " \\______.-'// .'.' \\*|\n" +
+ " \\| \\ | // .'.' _ |*|\n" +
+ " ` \\|// .'.'_ _ _|*|\n" +
+ " . .// .'.' | _ _ \\*|\n" +
+ " \\`-|\\_/ / \\ _ _ \\*\\\n" +
+ " `/'\\__/ \\ _ _ \\*\\\n" +
+ " /^| \\ _ _ \\*\n" +
+ " ' ` \\ _ _ \\ ");
+ casinoArtHashMap.put(Art.BLACKJACK, "8 888888888o 8 8888 .8. ,o888888o. 8 8888 ,88' 8 8888 .8. ,o888888o. 8 8888 ,88' \n" +
+ "8 8888 `88. 8 8888 .888. 8888 `88. 8 8888 ,88' 8 8888 .888. 8888 `88. 8 8888 ,88' \n" +
+ "8 8888 `88 8 8888 :88888. ,8 8888 `8. 8 8888 ,88' 8 8888 :88888. ,8 8888 `8. 8 8888 ,88' \n" +
+ "8 8888 ,88 8 8888 . `88888. 88 8888 8 8888 ,88' 8 8888 . `88888. 88 8888 8 8888 ,88' \n" +
+ "8 8888. ,88' 8 8888 .8. `88888. 88 8888 8 8888 ,88' 8 8888 .8. `88888. 88 8888 8 8888 ,88' \n" +
+ "8 8888888888 8 8888 .8`8. `88888. 88 8888 8 8888 88' 8 8888 .8`8. `88888. 88 8888 8 8888 88' \n" +
+ "8 8888 `88. 8 8888 .8' `8. `88888. 88 8888 8 888888< 88. 8 8888 .8' `8. `88888. 88 8888 8 888888< \n" +
+ "8 8888 88 8 8888 .8' `8. `88888.`8 8888 .8' 8 8888 `Y8. `88. 8 888'.8' `8. `88888.`8 8888 .8' 8 8888 `Y8. \n" +
+ "8 8888 ,88' 8 8888 .888888888. `88888. 8888 ,88' 8 8888 `Y8. `88o. 8 88'.888888888. `88888. 8888 ,88' 8 8888 `Y8. \n" +
+ "8 888888888P 8 888888888888 .8' `8. `88888. `8888888P' 8 8888 `Y8. `Y888888 ' .8' `8. `88888. `8888888P' 8 8888 `Y8. \n\n\n");
+ casinoArtHashMap.put(Art.CASINOLOBBY, " /$$$$$$ /$$ /$$ /$$ /$$ \n" +
+ " /$$__ $$ |__/ | $$ | $$ | $$ \n" +
+ "| $$ \\__/ /$$$$$$ /$$$$$$$ /$$ /$$$$$$$ /$$$$$$ | $$ /$$$$$$ | $$$$$$$ | $$$$$$$ /$$ /$$\n" +
+ "| $$ |____ $$ /$$_____/| $$| $$__ $$ /$$__ $$ | $$ /$$__ $$| $$__ $$| $$__ $$| $$ | $$\n" +
+ "| $$ /$$$$$$$| $$$$$$ | $$| $$ \\ $$| $$ \\ $$ | $$ | $$ \\ $$| $$ \\ $$| $$ \\ $$| $$ | $$\n" +
+ "| $$ $$ /$$__ $$ \\____ $$| $$| $$ | $$| $$ | $$ | $$ | $$ | $$| $$ | $$| $$ | $$| $$ | $$\n" +
+ "| $$$$$$/| $$$$$$$ /$$$$$$$/| $$| $$ | $$| $$$$$$/ | $$$$$$$$| $$$$$$/| $$$$$$$/| $$$$$$$/| $$$$$$$\n" +
+ " \\______/ \\_______/|_______/ |__/|__/ |__/ \\______/ |________/ \\______/ |_______/ |_______/ \\____ $$\n" +
+ " /$$ | $$\n" +
+ " | $$$$$$/\n" +
+ " \\______/ ");
+ casinoArtHashMap.put(Art.GAMEMENU, " _____ _____ _____ _____ _____ \n" +
+ " /\\ \\ /\\ \\ /\\ \\ /\\ \\ /\\ \\ \n" +
+ " /::\\ \\ /::\\ \\ /::\\____\\ /::\\ \\ /::\\ \\ \n" +
+ " /::::\\ \\ /::::\\ \\ /::::| | /::::\\ \\ /::::\\ \\ \n" +
+ " /::::::\\ \\ /::::::\\ \\ /:::::| | /::::::\\ \\ /::::::\\ \\ \n" +
+ " /:::/\\:::\\ \\ /:::/\\:::\\ \\ /::::::| | /:::/\\:::\\ \\ /:::/\\:::\\ \\ \n" +
+ " /:::/ \\:::\\ \\ /:::/__\\:::\\ \\ /:::/|::| | /:::/__\\:::\\ \\ /:::/__\\:::\\ \\ \n" +
+ " /:::/ \\:::\\ \\ /::::\\ \\:::\\ \\ /:::/ |::| | /::::\\ \\:::\\ \\ \\:::\\ \\:::\\ \\ \n" +
+ " /:::/ / \\:::\\ \\ /::::::\\ \\:::\\ \\ /:::/ |::|___|______ /::::::\\ \\:::\\ \\ ___\\:::\\ \\:::\\ \\ \n" +
+ " /:::/ / \\:::\\ ___\\ /:::/\\:::\\ \\:::\\ \\ /:::/ |::::::::\\ \\ /:::/\\:::\\ \\:::\\ \\ /\\ \\:::\\ \\:::\\ \\ \n" +
+ "/:::/____/ ___\\:::| |/:::/ \\:::\\ \\:::\\____\\/:::/ |:::::::::\\____\\/:::/__\\:::\\ \\:::\\____\\/::\\ \\:::\\ \\:::\\____\\\n" +
+ "\\:::\\ \\ /\\ /:::|____|\\::/ \\:::\\ /:::/ /\\::/ / ~~~~~/:::/ /\\:::\\ \\:::\\ \\::/ /\\:::\\ \\:::\\ \\::/ /\n" +
+ " \\:::\\ /::\\ \\::/ / \\/____/ \\:::\\/:::/ / \\/____/ /:::/ / \\:::\\ \\:::\\ \\/____/ \\:::\\ \\:::\\ \\/____/ \n" +
+ " \\:::\\ \\:::\\ \\/____/ \\::::::/ / /:::/ / \\:::\\ \\:::\\ \\ \\:::\\ \\:::\\ \\ \n" +
+ " \\:::\\ \\:::\\____\\ \\::::/ / /:::/ / \\:::\\ \\:::\\____\\ \\:::\\ \\:::\\____\\ \n" +
+ " \\:::\\ /:::/ / /:::/ / /:::/ / \\:::\\ \\::/ / \\:::\\ /:::/ / \n" +
+ " \\:::\\/:::/ / /:::/ / /:::/ / \\:::\\ \\/____/ \\:::\\/:::/ / \n" +
+ " \\::::::/ / /:::/ / /:::/ / \\:::\\ \\ \\::::::/ / \n" +
+ " \\::::/ / /:::/ / /:::/ / \\:::\\____\\ \\::::/ / \n" +
+ " \\::/____/ \\::/ / \\::/ / \\::/ / \\::/ / \n" +
+ " \\/____/ \\/____/ \\/____/ \\/____/ \n" +
+ " ");
+ casinoArtHashMap.put(Art.PLAYERMENU, " _______ _ _ _ _ _ ____ _____ _____ ____ _____ _ \n" +
+ " |__ __| | | \\ | | | | (_) | _ \\ |_ _| / ____| |___ \\ / ____| (_) \n" +
+ " | | | |__ ___ | \\| | ___ | |_ ___ _ __ _ ___ _ _ ___ | |_) | | | | | __ __) | | | __ _ ___ _ _ __ ___ \n" +
+ " | | | '_ \\ / _ \\ | . ` |/ _ \\| __/ _ \\| '__| |/ _ \\| | | / __| | _ < | | | | |_ | |__ < | | / _` / __| | '_ \\ / _ \\ \n" +
+ " | | | | | | __/ | |\\ | (_) | || (_) | | | | (_) | |_| \\__ \\ | |_) | _| |_ | |__| |_ ___) | | |___| (_| \\__ \\ | | | | (_) |\n" +
+ " |_| |_| |_|\\___| |_| \\_|\\___/ \\__\\___/|_| |_|\\___/ \\__,_|___/ |____(_)_____(_)_____(_) |____/ \\_____\\__,_|___/_|_| |_|\\___/ \n" +
+ " \n" +
+ " ");
+ casinoArtHashMap.put(Art.ROULETTE, " ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ \n" +
+ "▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌\n" +
+ "▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌▐░▌ ▐░█▀▀▀▀▀▀▀▀▀ ▀▀▀▀█░█▀▀▀▀ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ \n" +
+ "▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ \n" +
+ "▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ \n" +
+ "▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░░░░░░░░░░░▌ ▐░▌ ▐░▌ ▐░░░░░░░░░░░▌\n" +
+ "▐░█▀▀▀▀█░█▀▀ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀▀▀ \n" +
+ "▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ \n" +
+ "▐░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ \n" +
+ "▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░▌ ▐░░░░░░░░░░░▌\n" +
+ " ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ \n" +
+ " \n\n");
+ casinoArtHashMap.put(Art.HIGHANDLOW, " ██░ ██ ██▓ ▄████ ██░ ██ ▄▄▄ ███▄ █ ▓█████▄ ██▓ ▒█████ █ █░\n" +
+ "▓██░ ██▒▓██▒ ██▒ ▀█▒▓██░ ██▒ ▒████▄ ██ ▀█ █ ▒██▀ ██▌ ▓██▒ ▒██▒ ██▒▓█░ █ ░█░\n" +
+ "▒██▀▀██░▒██▒▒██░▄▄▄░▒██▀▀██░ ▒██ ▀█▄ ▓██ ▀█ ██▒░██ █▌ ▒██░ ▒██░ ██▒▒█░ █ ░█ \n" +
+ "░▓█ ░██ ░██░░▓█ ██▓░▓█ ░██ ░██▄▄▄▄██ ▓██▒ ▐▌██▒░▓█▄ ▌ ▒██░ ▒██ ██░░█░ █ ░█ \n" +
+ "░▓█▒░██▓░██░░▒▓███▀▒░▓█▒░██▓ ▓█ ▓██▒▒██░ ▓██░░▒████▓ ░██████▒░ ████▓▒░░░██▒██▓ \n" +
+ " ▒ ░░▒░▒░▓ ░▒ ▒ ▒ ░░▒░▒ ▒▒ ▓▒█░░ ▒░ ▒ ▒ ▒▒▓ ▒ ░ ▒░▓ ░░ ▒░▒░▒░ ░ ▓░▒ ▒ \n" +
+ " ▒ ░▒░ ░ ▒ ░ ░ ░ ▒ ░▒░ ░ ▒ ▒▒ ░░ ░░ ░ ▒░ ░ ▒ ▒ ░ ░ ▒ ░ ░ ▒ ▒░ ▒ ░ ░ \n" +
+ " ░ ░░ ░ ▒ ░░ ░ ░ ░ ░░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ \n" +
+ " ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ \n" +
+ " ░ ");
+ casinoArtHashMap.put(Art.CRAPS, " ,----.. \n" +
+ " / / \\ ,-.----. \n" +
+ "| : : __ ,-. \\ / \\ \n" +
+ ". | ;. /,' ,'/ /| | : | .--.--. \n" +
+ ". ; /--` ' | |' | ,--.--. | | .\\ : / / ' \n" +
+ "; | ; | | ,'/ \\ . : |: || : /`./ \n" +
+ "| : | ' : / .--. .-. | | | \\ :| : ;_ \n" +
+ ". | '___ | | ' \\__\\/: . . | : . | \\ \\ `. \n" +
+ "' ; : .'|; : | ,\" .--.; | : |`-' `----. \\ \n" +
+ "' | '/ :| , ; / / ,. | : : : / /`--' / \n" +
+ "| : / ---' ; : .' \\| | : '--'. / \n" +
+ " \\ \\ .' | , .-./`---'.| `--'---' \n" +
+ " `---` `--`---' `---` \n" +
+ " _______.\n" +
+ " ______ | . . |\\\n" +
+ " / /\\ | . |.\\\n" +
+ " / ' / \\ | . . |.'|\n" +
+ "/_____/. . \\ |_______|.'|\n" +
+ "\\ . . \\ / \\ ' . \\'|\n" +
+ " \\ . . \\ / \\____'__\\|\n" +
+ " \\_____\\/\n\n");
+ casinoArtHashMap.put(Art.SLOTS, " .----------------. .----------------. .----------------. .----------------. .----------------. \n" +
+ "| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. |\n" +
+ "| | _______ | || | _____ | || | ____ | || | _________ | || | _______ | |\n" +
+ "| | / ___ | | || | |_ _| | || | .' `. | || | | _ _ | | || | / ___ | | |\n" +
+ "| | | (__ \\_| | || | | | | || | / .--. \\ | || | |_/ | | \\_| | || | | (__ \\_| | |\n" +
+ "| | '.___`-. | || | | | _ | || | | | | | | || | | | | || | '.___`-. | |\n" +
+ "| | |`\\____) | | || | _| |__/ | | || | \\ `--' / | || | _| |_ | || | |`\\____) | | |\n" +
+ "| | |_______.' | || | |________| | || | `.____.' | || | |_____| | || | |_______.' | |\n" +
+ "| | | || | | || | | || | | || | | |\n" +
+ "| '--------------' || '--------------' || '--------------' || '--------------' || '--------------' |\n" +
+ " '----------------' '----------------' '----------------' '----------------' '----------------' ");
+ casinoArtHashMap.put(Art.GOFISH, " _,---. _,.---._ _,---. .=-.-. ,-,--. ,--.-,,-,--, \n" +
+ " _.='.'-, \\ ,-.' , - `. .-`.' , \\ /==/_ /,-.'- _\\/==/ /|=| | \n" +
+ " /==.'- / /==/_, , - \\ /==/_ _.-'|==|, |/==/_ ,_.'|==|_ ||=|, | \n" +
+ "/==/ - .-' |==| .=. | /==/- '..-.|==| |\\==\\ \\ |==| ,|/=| _| \n" +
+ "|==|_ /_,-.|==|_ : ;=: - | |==|_ , /|==|- | \\==\\ -\\ |==|- `-' _ | \n" +
+ "|==| , \\_.' )==| , '=' | |==| .--' |==| ,| _\\==\\ ,\\ |==| _ | \n" +
+ "\\==\\- , ( \\==\\ - ,_ / |==|- | |==|- |/==/\\/ _ ||==| .-. ,\\ \n" +
+ " /==/ _ , / '.='. - .' /==/ \\ /==/. /\\==\\ - , //==/, //=/ | \n" +
+ " `--`------' `--`--'' `--`---' `--`-` `--`---' `--`-' `-`--` \n\n\n" +
+ " _J\"\"-.\n" +
+ " .-\"\"L_ /o ) \\ ,';\n" +
+ " ;`, / ( o\\ \\ ,' ; /\n" +
+ " \\ ; `, / \"-.__.'\"\\_;\n" +
+ " ;_/\"`.__.-\"");
+
+
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/io/zipcoder/casino/utilities/Console.java b/src/main/java/io/zipcoder/casino/utilities/Console.java
index ab896c956..f0a2d9944 100644
--- a/src/main/java/io/zipcoder/casino/utilities/Console.java
+++ b/src/main/java/io/zipcoder/casino/utilities/Console.java
@@ -3,6 +3,8 @@
import java.io.InputStream;
import java.io.PrintStream;
+import java.sql.SQLOutput;
+import java.util.ArrayList;
import java.util.Scanner;
/**
@@ -26,7 +28,7 @@ public void println(String val, Object... vals) {
}
public String getStringInput(String prompt, Object... args) {
- println(prompt, args);
+ print(prompt, args);
return input.nextLine();
}
@@ -57,5 +59,77 @@ public Long getLongInput(String prompt, Object... args) {
public Integer getIntegerInput(String prompt, Object... args) {
return getLongInput(prompt, args).intValue();
}
+
+ public void printFast(String val) {
+ int count = 0;
+ for (char c : val.toCharArray()) {
+ output.print(c);
+ count++;
+ if ((count % 5) == 0) {
+ delay(5);
+ }
+ }
+ }
+
+ public void printSlow(String val) {
+ for (char c : val.toCharArray()) {
+ output.print(c);
+ delay(15);
+ }
+ }
+
+ public void newln() {
+ print("\n");
+ }
+
+ public void delay(Integer milliSeconds) {
+ try {
+ Thread.sleep(milliSeconds);
+ } catch (InterruptedException e) {
+ System.out.println("Error, Interrupted");
+ }
+ }
+
+ public void dotDotDot() {
+ delay(200);
+ print(".");
+ delay(300);
+ print(".");
+ delay(400);
+ print(".");
+ }
+
+ public static void clearScreen() {
+ for (int i = 0; i <= 2; i++)
+ System.out.print("$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ \n");
+ }
+
+
+ public static void displayGameMenu() {
+ System.out.println("Hi! Welcome to the game menu!\nHere are the games you can play:");
+ System.out.println("(1) - Go Fish");
+ System.out.println("(2) - Blackjack");
+ System.out.println("(3) - Craps");
+ System.out.println("(4) - Snakes & Ladders");
+ System.out.println("(5) - Roulette");
+ System.out.println("(6) - Slots");
+ System.out.println("(7) - High or Low");
+ System.out.println("(8) - Return to Casino");
+ }
+
+ public static void displayCasinoMenu() {
+ System.out.println("What would you like to do?");
+ System.out.println("(1) - Display Game Menu");
+ System.out.println("(2) - Check your Balance");
+ System.out.println("(3) - See your History");
+ System.out.println("(4) - Return to Player Menu");
+ }
+
+ public static void displayPlayerMenu(){
+ System.out.println("Welcome stranger! Have I seen you before?");
+ System.out.println("(1) - Yes, My name is...");
+ System.out.println("(2) - No it is my first time!");
+ System.out.println("(3) - Never mind, forgot my wallet T^T");
+ }
}
diff --git a/src/main/java/io/zipcoder/casino/utilities/Sound.java b/src/main/java/io/zipcoder/casino/utilities/Sound.java
new file mode 100644
index 000000000..3379b65bb
--- /dev/null
+++ b/src/main/java/io/zipcoder/casino/utilities/Sound.java
@@ -0,0 +1,41 @@
+package io.zipcoder.casino.utilities;
+
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.Clip;
+import java.io.File;
+
+public class Sound {
+
+ Clip clip;
+
+ public Sound(String fileName) {
+ try {
+ clip = AudioSystem.getClip();
+ File soundFile = new File("./sounds/" + fileName);
+ AudioInputStream inputStream = AudioSystem.getAudioInputStream(soundFile);
+
+ clip.open(inputStream);
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ }
+ }
+
+ public void play() {
+ stop();
+ reset();
+ start();
+ }
+
+ public void start() {
+ clip.start();
+ }
+
+ public void stop() {
+ clip.stop();
+ }
+
+ public void reset() {
+ clip.setFramePosition(0);
+ }
+}
diff --git a/src/test/java/io/zipcoder/casino/CasinoArtTest.java b/src/test/java/io/zipcoder/casino/CasinoArtTest.java
new file mode 100644
index 000000000..e191fa225
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/CasinoArtTest.java
@@ -0,0 +1,86 @@
+package io.zipcoder.casino;
+
+import io.zipcoder.casino.utilities.CasinoArt;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CasinoArtTest {
+
+ @Test
+ public void getCasinoArt1() {
+ CasinoArt art = new CasinoArt();
+ String game = "snakesAndLadders";
+ String expected = " _________ __ .___ .____ .___ .___ \n" +
+ " / _____/ ____ _____ | | __ ____ ______ _____ ____ __| _/ | | _____ __| _/__| _/___________ ______\n" +
+ " \\_____ \\ / \\\\__ \\ | |/ // __ \\ / ___/ \\__ \\ / \\ / __ | | | \\__ \\ / __ |/ __ |/ __ \\_ __ \\/ ___/\n" +
+ " / \\ | \\/ __ \\| <\\ ___/ \\___ \\ / __ \\| | \\/ /_/ | | |___ / __ \\_/ /_/ / /_/ \\ ___/| | \\/\\___ \\ \n" +
+ "/_______ /___| (____ /__|_ \\\\___ >____ > (____ /___| /\\____ | |_______ (____ /\\____ \\____ |\\___ >__| /____ >\n" +
+ " \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \n\n\n" +
+ " ---_ ......._-_--.\n" +
+ " (|\\ / / /| \\ \\\n" +
+ " / / .' -=-' `.\n" +
+ " / / .' )\n" +
+ " _/ / .' _.) /\n" +
+ " / o o _.-' / .'\n" +
+ " \\ _.-' / .'*|\n" +
+ " \\______.-'// .'.' \\*|\n" +
+ " \\| \\ | // .'.' _ |*|\n" +
+ " ` \\|// .'.'_ _ _|*|\n" +
+ " . .// .'.' | _ _ \\*|\n" +
+ " \\`-|\\_/ / \\ _ _ \\*\\\n" +
+ " `/'\\__/ \\ _ _ \\*\\\n" +
+ " /^| \\ _ _ \\*\n" +
+ " ' ` \\ _ _ \\ ";
+ String actual = art.getCasinoArt(CasinoArt.Art.SNAKESANDLADDERS);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void getCasinoArt2() {
+ CasinoArt art = new CasinoArt();
+ String game = "gameMenu";
+ String expected = " _____ _____ _____ _____ _____ \n" +
+ " /\\ \\ /\\ \\ /\\ \\ /\\ \\ /\\ \\ \n" +
+ " /::\\ \\ /::\\ \\ /::\\____\\ /::\\ \\ /::\\ \\ \n" +
+ " /::::\\ \\ /::::\\ \\ /::::| | /::::\\ \\ /::::\\ \\ \n" +
+ " /::::::\\ \\ /::::::\\ \\ /:::::| | /::::::\\ \\ /::::::\\ \\ \n" +
+ " /:::/\\:::\\ \\ /:::/\\:::\\ \\ /::::::| | /:::/\\:::\\ \\ /:::/\\:::\\ \\ \n" +
+ " /:::/ \\:::\\ \\ /:::/__\\:::\\ \\ /:::/|::| | /:::/__\\:::\\ \\ /:::/__\\:::\\ \\ \n" +
+ " /:::/ \\:::\\ \\ /::::\\ \\:::\\ \\ /:::/ |::| | /::::\\ \\:::\\ \\ \\:::\\ \\:::\\ \\ \n" +
+ " /:::/ / \\:::\\ \\ /::::::\\ \\:::\\ \\ /:::/ |::|___|______ /::::::\\ \\:::\\ \\ ___\\:::\\ \\:::\\ \\ \n" +
+ " /:::/ / \\:::\\ ___\\ /:::/\\:::\\ \\:::\\ \\ /:::/ |::::::::\\ \\ /:::/\\:::\\ \\:::\\ \\ /\\ \\:::\\ \\:::\\ \\ \n" +
+ "/:::/____/ ___\\:::| |/:::/ \\:::\\ \\:::\\____\\/:::/ |:::::::::\\____\\/:::/__\\:::\\ \\:::\\____\\/::\\ \\:::\\ \\:::\\____\\\n" +
+ "\\:::\\ \\ /\\ /:::|____|\\::/ \\:::\\ /:::/ /\\::/ / ~~~~~/:::/ /\\:::\\ \\:::\\ \\::/ /\\:::\\ \\:::\\ \\::/ /\n" +
+ " \\:::\\ /::\\ \\::/ / \\/____/ \\:::\\/:::/ / \\/____/ /:::/ / \\:::\\ \\:::\\ \\/____/ \\:::\\ \\:::\\ \\/____/ \n" +
+ " \\:::\\ \\:::\\ \\/____/ \\::::::/ / /:::/ / \\:::\\ \\:::\\ \\ \\:::\\ \\:::\\ \\ \n" +
+ " \\:::\\ \\:::\\____\\ \\::::/ / /:::/ / \\:::\\ \\:::\\____\\ \\:::\\ \\:::\\____\\ \n" +
+ " \\:::\\ /:::/ / /:::/ / /:::/ / \\:::\\ \\::/ / \\:::\\ /:::/ / \n" +
+ " \\:::\\/:::/ / /:::/ / /:::/ / \\:::\\ \\/____/ \\:::\\/:::/ / \n" +
+ " \\::::::/ / /:::/ / /:::/ / \\:::\\ \\ \\::::::/ / \n" +
+ " \\::::/ / /:::/ / /:::/ / \\:::\\____\\ \\::::/ / \n" +
+ " \\::/____/ \\::/ / \\::/ / \\::/ / \\::/ / \n" +
+ " \\/____/ \\/____/ \\/____/ \\/____/ \n" +
+ " ";
+ String actual = art.getCasinoArt(CasinoArt.Art.GAMEMENU);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void getCasinoArt3() {
+ CasinoArt art = new CasinoArt();
+ String game = "casinoLobby";
+ String expected = " /$$$$$$ /$$ /$$ /$$ /$$ \n" +
+ " /$$__ $$ |__/ | $$ | $$ | $$ \n" +
+ "| $$ \\__/ /$$$$$$ /$$$$$$$ /$$ /$$$$$$$ /$$$$$$ | $$ /$$$$$$ | $$$$$$$ | $$$$$$$ /$$ /$$\n" +
+ "| $$ |____ $$ /$$_____/| $$| $$__ $$ /$$__ $$ | $$ /$$__ $$| $$__ $$| $$__ $$| $$ | $$\n" +
+ "| $$ /$$$$$$$| $$$$$$ | $$| $$ \\ $$| $$ \\ $$ | $$ | $$ \\ $$| $$ \\ $$| $$ \\ $$| $$ | $$\n" +
+ "| $$ $$ /$$__ $$ \\____ $$| $$| $$ | $$| $$ | $$ | $$ | $$ | $$| $$ | $$| $$ | $$| $$ | $$\n" +
+ "| $$$$$$/| $$$$$$$ /$$$$$$$/| $$| $$ | $$| $$$$$$/ | $$$$$$$$| $$$$$$/| $$$$$$$/| $$$$$$$/| $$$$$$$\n" +
+ " \\______/ \\_______/|_______/ |__/|__/ |__/ \\______/ |________/ \\______/ |_______/ |_______/ \\____ $$\n" +
+ " /$$ | $$\n" +
+ " | $$$$$$/\n" +
+ " \\______/ ";
+ String actual = art.getCasinoArt(CasinoArt.Art.CASINOLOBBY);
+ Assert.assertEquals(expected,actual);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/CasinoMainTest.java b/src/test/java/io/zipcoder/casino/CasinoMainTest.java
new file mode 100644
index 000000000..45259f234
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/CasinoMainTest.java
@@ -0,0 +1,12 @@
+package io.zipcoder.casino;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class CasinoMainTest {
+
+ @Test
+ public void main() {
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/GameMenuTest.java b/src/test/java/io/zipcoder/casino/GameMenuTest.java
new file mode 100644
index 000000000..6e8f869ac
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/GameMenuTest.java
@@ -0,0 +1,10 @@
+package io.zipcoder.casino;
+
+import io.zipcoder.casino.Menus.GameMenu;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class GameMenuTest {
+
+
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/GamePieces/CardTest.java b/src/test/java/io/zipcoder/casino/GamePieces/CardTest.java
new file mode 100644
index 000000000..7347e2375
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/GamePieces/CardTest.java
@@ -0,0 +1,69 @@
+package io.zipcoder.casino.GamePieces;
+
+import io.zipcoder.casino.GamePieces.Card;
+import io.zipcoder.casino.GamePieces.CardValue;
+import io.zipcoder.casino.GamePieces.Suit;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.BlockJUnit4ClassRunner;
+
+public class CardTest {
+
+ @Test
+ public void constructorTest1(){
+ Card card = new Card(CardValue.SEVEN, Suit.SPADES);
+ CardValue expectedValue = CardValue.SEVEN;
+ CardValue actualValue = card.getCardValue();
+
+ Assert.assertEquals(expectedValue,actualValue);
+ }
+
+ @Test
+ public void ConstructorTest2(){
+ Card card = new Card(CardValue.SEVEN,Suit.SPADES);
+ Suit expectedSuit = Suit.SPADES;
+ Suit actualSuit = card.getSuit();
+
+ Assert.assertEquals(expectedSuit,actualSuit);
+ }
+
+ @Test
+ public void getSuit() {
+ Card card = new Card(null,Suit.DIAMONDS);
+ Suit expectedSuit = Suit.DIAMONDS;
+ Suit actualSuit = card.getSuit();
+
+ Assert.assertEquals(expectedSuit,actualSuit);
+
+ }
+
+ @Test
+ public void setSuit() {
+ Card card = new Card(null,null);
+ Suit expected = Suit.HEARTS;
+ card.setSuit(expected);
+
+
+ Assert.assertEquals(expected,card.getSuit());
+ }
+
+ @Test
+ public void getCardValue() {
+ Card card = new Card(CardValue.JACK,null);
+ CardValue expectedValue = CardValue.JACK;
+ CardValue actualValue = card.getCardValue();
+
+ Assert.assertEquals(expectedValue,actualValue);
+ }
+
+ @Test
+ public void setCardValue() {
+ Card card = new Card(null,null);
+ CardValue expected = CardValue.TWO;
+ card.setCardValue(expected);
+
+
+ Assert.assertEquals(expected,card.getCardValue());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/GamePieces/CardValueTest.java b/src/test/java/io/zipcoder/casino/GamePieces/CardValueTest.java
new file mode 100644
index 000000000..49307a7c0
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/GamePieces/CardValueTest.java
@@ -0,0 +1,17 @@
+package io.zipcoder.casino.GamePieces;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class CardValueTest {
+
+
+ @Test
+ public void testToString() {
+ }
+
+ @Test
+ public void fromInt() {
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/GamePieces/DeckTest.java b/src/test/java/io/zipcoder/casino/GamePieces/DeckTest.java
new file mode 100644
index 000000000..d5c8b062b
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/GamePieces/DeckTest.java
@@ -0,0 +1,42 @@
+package io.zipcoder.casino.GamePieces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class DeckTest {
+
+ @Test
+ public void cardsLeft1() {
+ Deck deck = new Deck();
+ Integer expected = 52;
+ Integer actual = deck.cardsLeft();
+
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void cardsLeft2() {
+ Deck deck = new Deck();
+ Integer expected = 51;
+ deck.draw();
+ Integer actual = deck.cardsLeft();
+
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void shuffle() {
+ }
+
+ @Test
+ public void draw() {
+ Deck deck = new Deck();
+ Integer expected = 51;
+ deck.draw();
+ Integer actual = deck.cardsLeft();
+
+ Assert.assertEquals(expected,actual);
+ }
+ }
diff --git a/src/test/java/io/zipcoder/casino/GamePieces/DiceTest.java b/src/test/java/io/zipcoder/casino/GamePieces/DiceTest.java
new file mode 100644
index 000000000..749b60455
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/GamePieces/DiceTest.java
@@ -0,0 +1,72 @@
+package io.zipcoder.casino.GamePieces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class DiceTest {
+
+ @Test
+ public void rollDiceTest1() {
+ Integer numberOfDice = 2;
+ Dice dice = new Dice();
+ Integer expected = dice.rollDice(numberOfDice);
+ Assert.assertTrue(expected >= numberOfDice && expected <= numberOfDice * 6);
+ }
+
+ @Test
+ public void rollDiceTest2() {
+ Integer numberOfDice = 5;
+ Dice dice = new Dice();
+ Integer expected = dice.rollDice(numberOfDice);
+ Assert.assertTrue(expected >= numberOfDice && expected <= numberOfDice * 6);
+ }
+
+ @Test
+ public void rollDiceTest3() {
+ Integer numberOfDice = 300;
+ Dice dice = new Dice();
+ Integer expected = dice.rollDice(numberOfDice);
+ Assert.assertTrue(expected >= numberOfDice && expected <= numberOfDice * 6);
+ }
+
+ @Test
+ public void diceArtTest1(){
+ Dice dice = new Dice();
+ Integer roll = 6;
+ String expected = "+-----+\n" +
+ "| o o |\n" +
+ "| o o |\n" +
+ "| o o |\n" +
+ "+-----+";
+ String actual = dice.diceArt(roll);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void diceArtTest2(){
+ Dice dice = new Dice();
+ Integer roll = 2;
+ String expected = "+-----+\n" +
+ "| o |\n" +
+ "| |\n" +
+ "| o |\n" +
+ "+-----+";
+ String actual = dice.diceArt(roll);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void diceArtTest3(){
+ Dice dice = new Dice();
+ Integer roll = 3;
+ String expected = "+-----+\n" +
+ "| o |\n" +
+ "| o |\n" +
+ "| o |\n" +
+ "+-----+";
+ String actual = dice.diceArt(roll);
+ Assert.assertEquals(expected,actual);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/GamePieces/RouletteSpinnerTest.java b/src/test/java/io/zipcoder/casino/GamePieces/RouletteSpinnerTest.java
new file mode 100644
index 000000000..d858100d4
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/GamePieces/RouletteSpinnerTest.java
@@ -0,0 +1,20 @@
+package io.zipcoder.casino.GamePieces;
+
+
+import io.zipcoder.casino.Games.Roulette.Roulette;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Random;
+
+import static org.junit.Assert.*;
+
+public class RouletteSpinnerTest {
+
+ @Test
+ public void winningNumber() {
+ Integer actual = RouletteSpinner.winningNumber();
+ Assert.assertTrue(actual <= 36 && actual >=0);
+
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/GamePieces/SlotMachineTest.java b/src/test/java/io/zipcoder/casino/GamePieces/SlotMachineTest.java
new file mode 100644
index 000000000..7a1a9a79b
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/GamePieces/SlotMachineTest.java
@@ -0,0 +1,29 @@
+package io.zipcoder.casino.GamePieces;
+
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SlotMachineTest {
+
+ @Test
+ public void randNum() {
+ Integer actual = SlotMachine.randNum();
+ Assert.assertTrue(actual <= 9 && actual >= 0);
+ }
+
+ @Test
+ public void createMachine() {
+
+ Integer[][] slot = new Integer[3][3];
+ SlotMachine slotMachine = new SlotMachine(slot);
+
+ Integer[][] machine = slotMachine.createMachine();
+ for (int i = 0; i < machine.length; i++) {
+ for (int j = 0; j < machine.length; j++) {
+ Assert.assertTrue((machine[i][j] >= 0) && (machine[i][j] <= 9));
+ }
+ }
+ }
+}
+
diff --git a/src/test/java/io/zipcoder/casino/GamePieces/SnakesLaddersPieceTest.java b/src/test/java/io/zipcoder/casino/GamePieces/SnakesLaddersPieceTest.java
new file mode 100644
index 000000000..0af5462cf
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/GamePieces/SnakesLaddersPieceTest.java
@@ -0,0 +1,30 @@
+package io.zipcoder.casino.GamePieces;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class SnakesLaddersPieceTest {
+
+ @Test
+ public void getCurrentPosition() {
+ SnakesLaddersPiece piece = new SnakesLaddersPiece();
+ Integer expected = 78;
+ piece.setCurrentPosition(expected);
+ Integer actual = piece.getCurrentPosition();
+
+ Assert.assertEquals(expected,actual);
+
+ }
+
+ @Test
+ public void setCurrentPosition() {
+ SnakesLaddersPiece piece = new SnakesLaddersPiece();
+ Integer expected = 78;
+ piece.setCurrentPosition(expected);
+ Integer actual = piece.getCurrentPosition();
+
+ Assert.assertEquals(expected,actual);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/Games/Blackjack/BlackJackTest.java b/src/test/java/io/zipcoder/casino/Games/Blackjack/BlackJackTest.java
new file mode 100644
index 000000000..88c404ee8
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/Games/Blackjack/BlackJackTest.java
@@ -0,0 +1,141 @@
+package io.zipcoder.casino.Games.Blackjack;
+
+import io.zipcoder.casino.GamePieces.Card;
+import io.zipcoder.casino.GamePieces.CardValue;
+import io.zipcoder.casino.GamePieces.Deck;
+import io.zipcoder.casino.GamePieces.Suit;
+import io.zipcoder.casino.PlayerCreation.Player;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import static org.junit.Assert.*;
+
+public class BlackJackTest {
+
+
+
+ @Test
+ public void initialHand() {
+
+ BlackJack blackJack = new BlackJack();
+ blackJack.deck = new Deck();
+ blackJack.initialHand();
+ assertTrue(blackJack.dealerHand[1]!=null);
+ assertTrue(blackJack.dealerHand[0]!=null);
+
+ }
+
+
+ @Test
+ public void placeBet() {
+ String input = "45";
+ InputStream in = new ByteArrayInputStream(input.getBytes());
+ System.setIn(in);
+ Player currentPlayer = new Player("Tidus" , 500);
+ BlackJack blackJack = new BlackJack();
+ blackJack.deck = new Deck();
+ blackJack.placeBet(currentPlayer);
+ assertTrue(blackJack.pot == 45);
+
+ }
+
+
+
+ @Test
+ public void hitOrStay() {
+ String input = "stay";
+ InputStream in = new ByteArrayInputStream(input.getBytes());
+ System.setIn(in);
+ BlackJack blackJack = new BlackJack();
+ blackJack.deck = new Deck();
+ blackJack.initialHand();
+ blackJack.hitOrStay();
+ assertTrue(blackJack.playerHand[2]==null);
+
+
+ }
+
+ @Test
+ public void hit() {
+
+ String input = "stay";
+ InputStream in = new ByteArrayInputStream(input.getBytes());
+ System.setIn(in);
+ BlackJack blackJack = new BlackJack();
+ blackJack.deck = new Deck();
+ blackJack.initialHand();
+ blackJack.hit();
+ assertTrue(blackJack.playerHand[2]!=null);
+ }
+
+ @Test
+ public void notBusted() {
+ BlackJack blackJack = new BlackJack();
+ blackJack.deck = new Deck();
+ assertTrue(blackJack.notBusted(20));
+ assertTrue(blackJack.notBusted(16));
+ assertFalse(blackJack.notBusted(30));
+ }
+
+ @Test
+ public void stay() {
+ BlackJack blackJack = new BlackJack();
+ blackJack.deck = new Deck();
+ blackJack.initialHand();
+ blackJack.stay();
+ assertTrue(blackJack.dealerHand[1]!=null);
+ assertTrue(blackJack.dealerHand[0]!=null);
+
+ }
+
+
+
+ @Test
+ public void isLoser() {
+ BlackJack blackJack = new BlackJack();
+ blackJack.deck = new Deck();
+ blackJack.initialHand();
+ blackJack.isLoser();
+ assertTrue(blackJack.getWinner().equals(blackJack.dealer));
+
+ }
+
+ @Test
+ public void checkHand() {
+
+ BlackJack blackJack = new BlackJack();
+ blackJack.deck = new Deck();
+ blackJack.initialHand();
+ assertTrue(blackJack.checkHand(blackJack.dealerHand).equals(blackJack.checkHand(blackJack.dealerHand)));
+ }
+
+
+
+
+
+ @Test
+ public void dealerMove() {
+ BlackJack blackJack = new BlackJack();
+ blackJack.deck = new Deck();
+ Card card = new Card(CardValue.TEN, Suit.HEARTS) ;
+ Card card1 = new Card(CardValue.SIX, Suit.HEARTS) ;
+ blackJack.dealerHand[0] = card;
+ blackJack.dealerHand[1] = card1;
+ blackJack.dealerMove();
+ assertTrue(blackJack.checkHand(blackJack.dealerHand)== 16);
+
+
+ }
+
+ @Test
+ public void getWinner() {
+ BlackJack blackJack = new BlackJack();
+ blackJack.deck = new Deck();
+ blackJack.initialHand();
+
+ blackJack.isLoser();
+ assertTrue(blackJack.getWinner().equals(blackJack.dealer));
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/Games/CrapsTest.java b/src/test/java/io/zipcoder/casino/Games/CrapsTest.java
new file mode 100644
index 000000000..53ceaaae2
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/Games/CrapsTest.java
@@ -0,0 +1,56 @@
+package io.zipcoder.casino.Games;
+
+import io.zipcoder.casino.Games.Craps.Craps;
+import io.zipcoder.casino.PlayerCreation.Player;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+public class CrapsTest {
+
+ Craps craps;
+ Player player;
+
+
+ @Test
+ public void rollTest() {
+
+ String input = "\n\n";
+ InputStream in = new ByteArrayInputStream(input.getBytes());
+ System.setIn(in);
+
+ craps = new Craps();
+
+ int roll = craps.roll();
+ Assert.assertTrue(roll > 1 && roll < 13);
+ }
+
+ @Test
+ public void playAgainTest() {
+
+ String input = "1\n";
+ InputStream in = new ByteArrayInputStream(input.getBytes());
+ System.setIn(in);
+
+ craps = new Craps();
+
+ Assert.assertTrue(craps.playAgain());
+
+ }
+
+ @Test
+ public void playAgainTest2() {
+
+ String input = "2\n";
+ InputStream in = new ByteArrayInputStream(input.getBytes());
+ System.setIn(in);
+
+ craps = new Craps();
+
+ Assert.assertFalse(craps.playAgain());
+
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/Games/GoFish/GoFishTest.java b/src/test/java/io/zipcoder/casino/Games/GoFish/GoFishTest.java
new file mode 100644
index 000000000..d833c83b2
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/Games/GoFish/GoFishTest.java
@@ -0,0 +1,166 @@
+package io.zipcoder.casino.Games.GoFish;
+
+import io.zipcoder.casino.GamePieces.Card;
+import io.zipcoder.casino.GamePieces.CardValue;
+import io.zipcoder.casino.GamePieces.Suit;
+import io.zipcoder.casino.PlayerCreation.Player;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+
+import static org.junit.Assert.*;
+
+public class GoFishTest {
+
+ Player player;
+ GoFish goFish;
+
+ @Before
+ public void setup() {
+
+ player = new Player("Test", 500);
+ goFish = new GoFish();
+
+
+ }
+
+ @Test
+ public void hasCardTest() {
+
+ ArrayList hand = new ArrayList<>();
+ hand.add(new Card(CardValue.ACE, Suit.CLUBS));
+ hand.add(new Card(CardValue.JACK, Suit.CLUBS));
+ hand.add(new Card(CardValue.NINE, Suit.CLUBS));
+ hand.add(new Card(CardValue.FIVE, Suit.CLUBS));
+ hand.add(new Card(CardValue.TWO, Suit.CLUBS));
+
+ Assert.assertTrue(goFish.hasCard(hand, CardValue.ACE));
+ Assert.assertTrue(goFish.hasCard(hand, CardValue.JACK));
+ Assert.assertTrue(goFish.hasCard(hand, CardValue.FIVE));
+ Assert.assertFalse(goFish.hasCard(hand, CardValue.EIGHT));
+
+ }
+
+ @Test
+ public void removeCardsTest() {
+ ArrayList hand = new ArrayList<>();
+ Card ace = new Card(CardValue.ACE, Suit.CLUBS);
+ hand.add(ace);
+ hand.add(new Card(CardValue.JACK, Suit.CLUBS));
+ hand.add(new Card(CardValue.NINE, Suit.CLUBS));
+ hand.add(new Card(CardValue.FIVE, Suit.CLUBS));
+ hand.add(new Card(CardValue.TWO, Suit.CLUBS));
+
+ goFish.removeCards(hand, CardValue.ACE);
+
+ Assert.assertFalse(hand.contains(ace));
+
+ Card nine = new Card(CardValue.NINE, Suit.CLUBS);
+ hand.add(nine);
+ goFish.removeCards(hand, CardValue.NINE);
+
+ Assert.assertFalse(hand.contains(nine));
+
+ }
+
+ @Test
+ public void checkBookTest() {
+
+ ArrayList hand = new ArrayList<>();
+ Card ace = new Card(CardValue.ACE, Suit.CLUBS);
+ hand.add(ace);
+ hand.add(new Card(CardValue.ACE, Suit.HEARTS));
+ hand.add(new Card(CardValue.ACE, Suit.DIAMONDS));
+ hand.add(new Card(CardValue.ACE, Suit.SPADES));
+ hand.add(new Card(CardValue.TWO, Suit.CLUBS));
+ hand.add(new Card(CardValue.TWO, Suit.DIAMONDS));
+ hand.add(new Card(CardValue.TWO, Suit.SPADES));
+
+ goFish.checkBook(hand, true);
+ assertFalse(goFish.hasCard(hand, CardValue.ACE));
+
+ hand.add(new Card(CardValue.ACE, Suit.CLUBS));
+ hand.add(new Card(CardValue.ACE, Suit.HEARTS));
+ hand.add(new Card(CardValue.ACE, Suit.DIAMONDS));
+ hand.add(new Card(CardValue.ACE, Suit.SPADES));
+
+ goFish.checkBook(hand, false);
+
+ assertFalse(goFish.hasCard(hand, CardValue.ACE));
+ assertTrue(goFish.hasCard(hand, CardValue.TWO));
+ }
+
+ @Test
+ public void checkHandTest() {
+ ArrayList destHand = new ArrayList<>();
+ destHand.add(new Card(CardValue.ACE, Suit.HEARTS));
+ destHand.add(new Card(CardValue.ACE, Suit.DIAMONDS));
+ destHand.add(new Card(CardValue.TWO, Suit.CLUBS));
+ destHand.add(new Card(CardValue.TWO, Suit.DIAMONDS));
+ destHand.add(new Card(CardValue.TWO, Suit.SPADES));
+
+ ArrayList guessHand = new ArrayList<>();
+ guessHand.add(new Card(CardValue.THREE, Suit.HEARTS));
+ guessHand.add(new Card(CardValue.ACE, Suit.DIAMONDS));
+ guessHand.add(new Card(CardValue.FOUR, Suit.CLUBS));
+ guessHand.add(new Card(CardValue.FIVE, Suit.DIAMONDS));
+ guessHand.add(new Card(CardValue.NINE, Suit.SPADES));
+
+ goFish.checkCard(CardValue.ACE, destHand, guessHand);
+
+ Assert.assertTrue(goFish.hasCard(destHand, CardValue.ACE));
+ Assert.assertFalse(goFish.hasCard(guessHand, CardValue.ACE));
+
+ }
+
+ @Test
+ public void fishTest() {
+ ArrayList destHand = new ArrayList<>();
+ destHand.add(new Card(CardValue.ACE, Suit.HEARTS));
+ destHand.add(new Card(CardValue.ACE, Suit.DIAMONDS));
+ destHand.add(new Card(CardValue.TWO, Suit.CLUBS));
+ destHand.add(new Card(CardValue.TWO, Suit.DIAMONDS));
+ destHand.add(new Card(CardValue.TWO, Suit.SPADES));
+
+ goFish.fish(destHand);
+
+ Assert.assertEquals(6, destHand.size());
+ }
+
+ @Test
+ public void aiGuessTest() {
+
+ goFish.dealHands();
+ assertTrue(goFish.aiGuess() != null);
+
+ }
+
+ @Test
+ public void playerGuessTest() {
+ String input = "2\nace\nking\nqueen\ndada\n19\n10\njack\n";
+ InputStream in = new ByteArrayInputStream(input.getBytes());
+ System.setIn(in);
+
+ goFish = new GoFish();
+
+ ArrayList hand = new ArrayList<>();
+ hand.add(new Card(CardValue.ACE, Suit.CLUBS));
+ hand.add(new Card(CardValue.JACK, Suit.CLUBS));
+ hand.add(new Card(CardValue.NINE, Suit.CLUBS));
+ hand.add(new Card(CardValue.FIVE, Suit.CLUBS));
+ hand.add(new Card(CardValue.TWO, Suit.CLUBS));
+ hand.add(new Card(CardValue.QUEEN, Suit.CLUBS));
+ hand.add(new Card(CardValue.KING, Suit.CLUBS));
+ hand.add(new Card(CardValue.TWO, Suit.CLUBS));
+
+ Assert.assertTrue(goFish.playerGuess(hand).equals(CardValue.TWO));
+ Assert.assertTrue(goFish.playerGuess(hand).equals(CardValue.ACE));
+ Assert.assertTrue(goFish.playerGuess(hand).equals(CardValue.KING));
+ Assert.assertTrue(goFish.playerGuess(hand).equals(CardValue.QUEEN));
+ Assert.assertTrue(goFish.playerGuess(hand).equals(CardValue.JACK));
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/Games/HighAndLow/HighAndLowTest.java b/src/test/java/io/zipcoder/casino/Games/HighAndLow/HighAndLowTest.java
new file mode 100644
index 000000000..a32e5bc27
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/Games/HighAndLow/HighAndLowTest.java
@@ -0,0 +1,221 @@
+package io.zipcoder.casino.Games.HighAndLow;
+
+
+import io.zipcoder.casino.PlayerCreation.Player;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+public class HighAndLowTest {
+ DateTimeFormatter dateTimeReformatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
+
+ @Test
+ public void firstRollTest(){
+ HighAndLow highAndLow = new HighAndLow();
+ Integer actual = highAndLow.firstRoll();
+ Assert.assertTrue(actual >= 2 || actual <= 12);
+ }
+
+ @Test
+ public void secondRollTest(){
+ HighAndLow highAndLow = new HighAndLow();
+ Integer actual = highAndLow.secondRoll();
+ Assert.assertTrue(actual >= 2 || actual <= 12);
+ }
+
+ @Test
+ public void enoughBalanceTest1(){
+ HighAndLow highAndLow = new HighAndLow();
+ Player currentPlayer = new Player(null,0);
+ Assert.assertFalse(highAndLow.enoughBalance(currentPlayer.getBalance()));
+ }
+
+
+ @Test
+ public void enoughBalanceTest2(){
+ HighAndLow highAndLow = new HighAndLow();
+ Player currentPlayer = new Player(null,Integer.MAX_VALUE);
+ Assert.assertTrue(highAndLow.enoughBalance(currentPlayer.getBalance()));
+ }
+
+ @Test
+ public void returnWinnings1(){
+ HighAndLow highAndLow = new HighAndLow();
+ Player currentPlayer = new Player(null,60);
+ Integer totalBetValue = 40;
+ Integer expected = 100;
+ highAndLow.returnWinnings(currentPlayer, totalBetValue);
+ Integer actual = currentPlayer.getBalance();
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void returnWinnings2(){
+ HighAndLow highAndLow = new HighAndLow();
+ Player currentPlayer = new Player(null,100);
+ Integer totalBetValue = 100;
+ Integer expected = 200;
+ highAndLow.returnWinnings(currentPlayer, totalBetValue);
+ Integer actual = currentPlayer.getBalance();
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void showRulesTest(){
+ HighAndLow highAndLow = new HighAndLow();
+ String expected = "\n\nA simple game for meager winnings. At High and Low,\n" +
+ "you'll only be able to but in at $10. Simply roll two dice, and our pit boss will\n" +
+ "present to you the sum of the rolls and the chance to bet $10 more on High or Low.\n" +
+ "If you believe the sum of the second roll will be higher, bet high.\n" +
+ "Likewise, if you believe the sum of the second roll will be lower, bet low.\n";
+ String actual = highAndLow.showRules();
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void winOrLose1(){
+ HighAndLow highAndLow = new HighAndLow();
+ Integer firstRoll = 7;
+ Integer secondRoll = 9;
+ String bet = "high";
+ Boolean actual = highAndLow.winOrLose(firstRoll,secondRoll,bet);
+ Assert.assertTrue(actual);
+ }
+
+ @Test
+ public void winOrLose2(){
+ HighAndLow highAndLow = new HighAndLow();
+ Integer firstRoll = 9;
+ Integer secondRoll = 7;
+ String bet = "high";
+ Boolean actual = highAndLow.winOrLose(firstRoll,secondRoll,bet);
+ Assert.assertFalse(actual);
+ }
+
+ @Test
+ public void winOrLose3(){
+ HighAndLow highAndLow = new HighAndLow();
+ Integer firstRoll = 7;
+ Integer secondRoll = 9;
+ String bet = "low";
+ Boolean actual = highAndLow.winOrLose(firstRoll,secondRoll,bet);
+ Assert.assertFalse(actual);
+ }
+
+ @Test
+ public void winOrLose4(){
+ HighAndLow highAndLow = new HighAndLow();
+ Integer firstRoll = 9;
+ Integer secondRoll = 7;
+ String bet = "low";
+ Boolean actual = highAndLow.winOrLose(firstRoll,secondRoll,bet);
+ Assert.assertTrue(actual);
+ }
+
+ @Test
+ public void highOrLowTest1(){
+ HighAndLow highAndLow = new HighAndLow();
+ Integer playerInput = 1;
+ String actual = "high";
+ String expected = highAndLow.highOrLowBet(playerInput);
+ Assert.assertEquals(actual, expected);
+ }
+
+ @Test
+ public void highOrLowTest2(){
+ HighAndLow highAndLow = new HighAndLow();
+ Integer playerInput = 2;
+ String actual = "low";
+ String expected = highAndLow.highOrLowBet(playerInput);
+ Assert.assertEquals(actual, expected);
+ }
+
+ @Test
+ public void secondBetTest1(){
+ HighAndLow highAndLow = new HighAndLow();
+ Integer playerInput = 1;
+ Assert.assertTrue(highAndLow.secondBet(playerInput));
+ }
+
+ @Test
+ public void secondBetTest2(){
+ HighAndLow highAndLow = new HighAndLow();
+ Integer playerInput = 2;
+ Assert.assertFalse(highAndLow.secondBet(playerInput));
+ }
+ @Test
+ public void placeBetTest(){
+ HighAndLow highAndLow = new HighAndLow();
+ Player currentPlayer = new Player(null,500);
+ Integer expected = 490;
+ highAndLow.placeBet(currentPlayer);
+ Integer actual = currentPlayer.getBalance();
+ Assert.assertEquals(expected,actual);
+ }
+ @Test
+ public void placeBetTes2(){
+ HighAndLow highAndLow = new HighAndLow();
+ Player currentPlayer = new Player(null,450);
+ Integer expected = 440;
+ highAndLow.placeBet(currentPlayer);
+ Integer actual = currentPlayer.getBalance();
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void resetGameTest(){
+ HighAndLow highAndLow = new HighAndLow();
+ Assert.assertTrue(highAndLow.resetGame());
+ }
+
+ @Test
+ public void noBetTest(){
+ HighAndLow highAndLow = new HighAndLow();
+ Integer totalBetValue = 1000;
+ String expected = String.format("You lost $%d.00 at High and Low. ** ", totalBetValue);
+ String actual = highAndLow.noBet(1000);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void addHistoryTest1(){
+ LocalDateTime now = LocalDateTime.now();
+ Player currentPlayer = new Player(null,null);
+ Boolean winner = true;
+ Integer totalBetValue = 1000;
+ HighAndLow highAndLow = new HighAndLow();
+ String expected = String.format("You won $%d.00 at High and Low! ** ", totalBetValue);
+ expected += dateTimeReformatter.format(now) + "\n";
+ highAndLow.addHistory(winner, totalBetValue, currentPlayer);
+ String actual = currentPlayer.printHistory();
+
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void addHistoryTest2(){
+ LocalDateTime now = LocalDateTime.now();
+ Player currentPlayer = new Player(null,null);
+ Boolean winner = false;
+ Integer totalBetValue = 1000;
+ HighAndLow highAndLow = new HighAndLow();
+ String expected = String.format("You lost $%d.00 at High and Low. ** ", totalBetValue);
+ expected += dateTimeReformatter.format(now) + "\n";
+ highAndLow.addHistory(winner, totalBetValue, currentPlayer);
+ String actual = currentPlayer.printHistory();
+
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void notEnoughmoneyTest(){
+ HighAndLow highAndLow = new HighAndLow();
+ String expected = "Loser";
+ String actual = highAndLow.notEnoughMoney();
+ Assert.assertEquals(actual,expected);
+ }
+}
diff --git a/src/test/java/io/zipcoder/casino/Games/Roulette/RouletteTest.java b/src/test/java/io/zipcoder/casino/Games/Roulette/RouletteTest.java
new file mode 100644
index 000000000..1365519d5
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/Games/Roulette/RouletteTest.java
@@ -0,0 +1,135 @@
+package io.zipcoder.casino.Games.Roulette;
+
+import io.zipcoder.casino.PlayerCreation.Player;
+import org.junit.Test;
+
+import java.lang.management.PlatformLoggingMXBean;
+
+import static org.junit.Assert.*;
+
+public class RouletteTest {
+
+ @Test
+ public void winningNumberTest() {
+ Roulette roulette = new Roulette();
+ Integer expected = roulette.winningNumber();
+ boolean greaterThanZero = expected >= 0;
+ boolean lessThan36 = expected <=36;
+
+ assertTrue(greaterThanZero);
+ assertTrue(lessThan36);
+ }
+
+ @Test
+ public void isWinnerTrueTest() {
+ //Given
+ Roulette roulette = new Roulette();
+ roulette.setOddEvenGame(false);
+ Integer num = 10;
+ roulette.setPlaceBetInt(num);
+ roulette.setSpinNum(num);
+ //When
+ boolean actual = roulette.isWinner();
+ //
+ assertTrue(actual);
+ }
+ @Test
+ public void isWinnerFalseTest(){
+ Roulette roulette = new Roulette();
+ roulette.setOddEvenGame(false);
+ Integer num = 10;
+ roulette.setPlaceBetInt(num);
+ roulette.setSpinNum(num-2);
+ //When
+ boolean actual = roulette.isWinner();
+ //
+ assertFalse(actual);
+ }
+ @Test
+ public void isOddWinnerTrueTest() {
+ Roulette roulette = new Roulette();
+ roulette.setOddEvenGame(true);
+ Integer num = 9;
+ roulette.setSpinNum(num);
+ roulette.setPlaceBetInt(1);
+
+ boolean actual = roulette.isWinner();
+
+ assertTrue(actual);
+ }
+ @Test
+ public void isOddWinnerFalseTest(){Roulette roulette = new Roulette();
+ roulette.setOddEvenGame(true);
+ Integer num = 9;
+ roulette.setSpinNum(num +1);
+ roulette.setPlaceBetInt(1);
+
+ boolean actual = roulette.isWinner();
+
+ assertFalse(actual);}
+ @Test
+ public void isEvenWinnerTrueTest(){Roulette roulette = new Roulette();
+ roulette.setOddEvenGame(true);
+ Integer num = 10;
+ roulette.setSpinNum(num);
+ roulette.setPlaceBetInt(0);
+
+ boolean actual = roulette.isWinner();
+
+ assertTrue(actual);}
+ @Test
+ public void isEvenWinnerFalseTest(){Roulette roulette = new Roulette();
+ roulette.setOddEvenGame(true);
+ Integer num = 10;
+ roulette.setSpinNum(num +1);
+ roulette.setPlaceBetInt(0);
+
+ boolean actual = roulette.isWinner();
+
+ assertFalse(actual);}
+ @Test
+ public void returnWinningsTest() {
+ Roulette roulette = new Roulette();
+ Player player = new Player("Bob", 999);
+
+ roulette.setOddEvenGame(true);
+ Integer num = 9;
+ roulette.setSpinNum(num);
+ roulette.setPlaceBetInt(1);
+
+ Integer pot = 5;
+ Integer multiplier = 2;
+ roulette.setPot(pot);
+ roulette.setMultiplier(multiplier);
+
+ Integer expected = player.getBalance() + pot * multiplier;
+ roulette.returnWinnings(player, 999);
+
+ Integer actual = player.getBalance();
+
+ assertEquals(expected,actual);
+ }
+
+ @Test
+ public void youLose() {
+ Roulette roulette = new Roulette();
+ Player player = new Player("Bob", 999);
+
+ roulette.setOddEvenGame(true);
+ Integer num = 9;
+ roulette.setSpinNum(num);
+ roulette.setPlaceBetInt(0);
+
+ Integer pot = 5;
+ roulette.setPot(pot);
+
+
+ Integer expected = player.getBalance() - pot ;
+ roulette.returnWinnings(player, 999);
+
+ Integer actual = player.getBalance()- pot;
+
+ assertEquals(expected,actual);
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/Games/SlotsTests.java b/src/test/java/io/zipcoder/casino/Games/SlotsTests.java
new file mode 100644
index 000000000..aad80601b
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/Games/SlotsTests.java
@@ -0,0 +1,134 @@
+package io.zipcoder.casino.Games;
+
+import io.zipcoder.casino.GamePieces.SlotMachine;
+import io.zipcoder.casino.Games.Slots.Slots;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SlotsTests {
+
+ @Before
+ public void setup(){
+ /*Integer[][] slot =
+ {{7,7,7},
+ {2,6,1},
+ {8,4,9}};
+
+ this.slotMachine = new SlotMachine(slot);*/
+
+
+ }
+
+ @Test
+ public void pullLeverTest(){}
+
+ @Test
+ public void isWinnerTrueTest(){
+ Slots slots = new Slots();
+ Integer[][] slot =
+ {{7,7,7},
+ {2,6,1},
+ {8,4,9}};
+ Boolean actualWinner = slots.isWinner(slot);
+
+ Assert.assertTrue(actualWinner);
+ }
+
+ @Test
+ public void isWinnerFalseTest(){
+ Slots slots = new Slots();
+ Integer[][] slot =
+ {{7,7,6},
+ {2,6,1},
+ {8,4,9}};
+ Boolean actualWinner = slots.isWinner(slot);
+
+ Assert.assertFalse(actualWinner);
+ }
+
+ @Test
+ public void checkHorizontalTrueTest(){
+ Slots slots = new Slots();
+ Integer[][] slot =
+ {{7,7,7},
+ {2,6,1},
+ {8,4,9}};
+
+ Boolean actualWinner = slots.checkHorizontal(slot);
+
+ Assert.assertTrue(actualWinner);
+ }
+
+ @Test
+ public void checkHorizontalFalseTest(){
+ Slots slots = new Slots();
+ Integer[][] slot =
+ {{7,4,7},
+ {2,6,1},
+ {8,4,9}};
+
+ Boolean actualWinner = slots.checkHorizontal(slot);
+
+ Assert.assertFalse(actualWinner);
+ }
+
+ @Test
+ public void checkVerticalTrueTest(){
+ Slots slots = new Slots();
+ Integer[][] slot =
+ {{7,5,7},
+ {7,6,1},
+ {7,4,9}};
+
+ Boolean actualWinner = slots.checkVertical(slot);
+
+ Assert.assertTrue(actualWinner);
+ }
+
+ @Test
+ public void checkVerticalFalseTest() {
+ Slots slots = new Slots();
+ Integer[][] slot =
+ {{7,7,7},
+ {2,6,1},
+ {8,4,9}};
+
+ Boolean actualWinner = slots.checkVertical(slot);
+
+ Assert.assertFalse(actualWinner);
+ }
+
+
+ @Test
+ public void checkDiagonalTrueTest(){
+ Slots slots = new Slots();
+ Integer[][] slot =
+ {{7,4,7},
+ {2,7,1},
+ {8,4,7}};
+
+ Boolean actualWinner = slots.checkDiagonal(slot);
+
+ Assert.assertTrue(actualWinner);
+ }
+
+ @Test
+ public void checkDiagonalFalseTest(){
+ Slots slots = new Slots();
+ Integer[][] slot =
+ {{7,7,7},
+ {2,2,1},
+ {8,4,9}};
+ Boolean actualWinner = slots.checkDiagonal(slot);
+
+ Assert.assertFalse(actualWinner);
+ }
+
+ @Test
+ public void returnWinningsTest(){}
+
+ @Test
+ public void youLoseTest(){}
+
+}
diff --git a/src/test/java/io/zipcoder/casino/Games/SnakesAndLadders/SnakesAndLaddersLanguageTest.java b/src/test/java/io/zipcoder/casino/Games/SnakesAndLadders/SnakesAndLaddersLanguageTest.java
new file mode 100644
index 000000000..1d822a921
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/Games/SnakesAndLadders/SnakesAndLaddersLanguageTest.java
@@ -0,0 +1,44 @@
+package io.zipcoder.casino.Games.SnakesAndLadders;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class SnakesAndLaddersLanguageTest {
+
+ @Test
+ public void getSnakeLanguageTest1() {
+ SnakesAndLaddersLanguage getSnakeLanguage = new SnakesAndLaddersLanguage();
+ String expected = getSnakeLanguage.getSnakeLanguage(SnakesAndLaddersLanguage.Language.PLAYERWINS);
+ String actual = "Congratulations! You won!";
+ Assert.assertEquals(expected,actual);
+ }
+ @Test
+ public void getSnakeLanguageTest2() {
+ SnakesAndLaddersLanguage getSnakeLanguage = new SnakesAndLaddersLanguage();
+ String expected = getSnakeLanguage.getSnakeLanguage(SnakesAndLaddersLanguage.Language.APPROACHTABLE);
+ String actual = "You approach the Snakes and Ladders table. What would you like to do?\n" +
+ "(1) - Play the game\n" +
+ "(2) - Read the rules\n" +
+ "(3) - Return to the game menu";
+ Assert.assertEquals(expected,actual);
+ }
+ @Test
+ public void getSnakeLanguageTest3() {
+ SnakesAndLaddersLanguage getSnakeLanguage = new SnakesAndLaddersLanguage();
+ String expected = getSnakeLanguage.getSnakeLanguage(SnakesAndLaddersLanguage.Language.RULES);
+ String actual = "Snakes and Ladders finds its origins in Ancient India, where it\n" +
+ "was first created under the name Moksha Patam.\n" +
+ "It was used to teach children values, rewarding proper behavior with\n" +
+ "a boost in point value, via climbing a ladder, or punishing a player\n" +
+ "in point value for bad behavior, via sliding down the back of a snake.\n\n" +
+ "Commercially known in the West as Chutes and Ladders, the game has been published by Milton Bradley\n" +
+ "since the 1940's, and players compete by rolling dice and\n" +
+ "and racing to the value of 100 points, the final spot on the board.\n" +
+ "But beware! Certain spots on the board will send you down the backs of the Snakes!\n" +
+ "Likewise, certain spots on the board will push you closer to your goal.\n" +
+ "Roll the dice and see who gets there first!\n\n";
+ Assert.assertEquals(expected,actual);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/Games/SnakesAndLadders/SnakesAndLaddersTest.java b/src/test/java/io/zipcoder/casino/Games/SnakesAndLadders/SnakesAndLaddersTest.java
new file mode 100644
index 000000000..2e045fc52
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/Games/SnakesAndLadders/SnakesAndLaddersTest.java
@@ -0,0 +1,168 @@
+package io.zipcoder.casino.Games.SnakesAndLadders;
+
+import io.zipcoder.casino.GamePieces.SnakesLaddersPiece;
+import org.junit.Test;
+import org.junit.Assert;
+
+public class SnakesAndLaddersTest {
+
+ @Test
+ public void setUpGameTest1(){
+ Integer expected = 0;
+ SnakesLaddersPiece playerPiece = new SnakesLaddersPiece();
+ SnakesLaddersPiece aiPiece = new SnakesLaddersPiece();
+ playerPiece.setCurrentPosition(expected);
+ aiPiece.setCurrentPosition(expected);
+ Integer actual = playerPiece.getCurrentPosition();
+ Integer actual2 = aiPiece.getCurrentPosition();
+
+ Assert.assertEquals(expected, actual);
+ Assert.assertEquals(expected, actual2);
+ }
+
+ @Test
+ public void snakesAndLaddersCheckerViaMapTest1(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ Integer position = 16;
+ Integer expected = 6;
+ Integer actual = snakesAndLadders.snakesAndLaddersCheckerViaMap(position);
+ Assert.assertEquals(expected,actual);
+ }
+ @Test
+ public void snakesAndLaddersCheckerViaMapTest2(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ Integer position = 1;
+ Integer expected = 38;
+ Integer actual = snakesAndLadders.snakesAndLaddersCheckerViaMap(position);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void snakesAndLaddersCheckerViaMapTest3(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ Integer position = 34;
+ Integer expected = 34;
+ Integer actual = snakesAndLadders.snakesAndLaddersCheckerViaMap(position);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void showRulesTest(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ String expected = "Snakes and Ladders finds its origins in Ancient India, where it\n" +
+ "was first created under the name Moksha Patam.\n" +
+ "It was used to teach children values, rewarding proper behavior with\n" +
+ "a boost in point value, via climbing a ladder, or punishing a player\n" +
+ "in point value for bad behavior, via sliding down the back of a snake.\n\n" +
+ "Commercially known in the West as Chutes and Ladders, the game has been published by Milton Bradley\n" +
+ "since the 1940's, and players compete by rolling dice and\n" +
+ "and racing to the value of 100 points, the final spot on the board.\n" +
+ "But beware! Certain spots on the board will send you down the backs of the Snakes!\n" +
+ "Likewise, certain spots on the board will push you closer to your goal.\n" +
+ "Roll the dice and see who gets there first!\n\n";
+ String actual = snakesAndLadders.showRules();
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void snakesAndLaddersCheckTest1(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ Integer position = 7;
+ Integer expected = 7;
+ Integer actual = snakesAndLadders.snakesAndLaddersCheck(position, true);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void snakesAndLaddersCheckTest2(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ Integer position = 16;
+ Integer expected = 6;
+ Integer actual = snakesAndLadders.snakesAndLaddersCheck(position, false);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void snakesAndLaddersCheckTest3(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ Integer position = 4;
+ Integer expected = 14;
+ Integer actual = snakesAndLadders.snakesAndLaddersCheck(position, true);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void snakesAndLaddersCheckTest4(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ Integer position = 4;
+ Integer expected = 14;
+ Integer actual = snakesAndLadders.snakesAndLaddersCheck(position, false);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void snakesAndLaddersCheckTest5(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ Integer position = 16;
+ Integer expected = 6;
+ Integer actual = snakesAndLadders.snakesAndLaddersCheck(position, true);
+ Assert.assertEquals(expected,actual);
+ }
+
+
+ @Test
+ public void diceRollTest1(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ Integer actual = snakesAndLadders.diceRoll();
+ Assert.assertTrue(actual <= 6 && actual >= 1);
+ }
+
+ @Test
+ public void testIfWonTest1(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ String expected = "Player";
+ String actual = snakesAndLadders.testIfWon(100, true);
+ Assert.assertEquals(expected,actual);
+ }
+ @Test
+ public void testIfWonTest2(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ String expected = "no winner yet";
+ String actual = snakesAndLadders.testIfWon(77, false);
+ Assert.assertEquals(expected,actual);
+ }
+ @Test
+ public void testIfWonTest3(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ String expected = "no winner yet";
+ String actual = snakesAndLadders.testIfWon(77, true);
+ Assert.assertEquals(expected,actual);
+ }
+ @Test
+ public void testIfWonTest4(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ String expected = "Ai";
+ String actual = snakesAndLadders.testIfWon(100, false);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void diceResults1(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ SnakesLaddersPiece piece = new SnakesLaddersPiece();
+ Integer roll = 6;
+ Integer expected = roll + piece.getCurrentPosition();
+ Integer actual = snakesAndLadders.diceResults(roll,true);
+ Assert.assertEquals(expected,actual);
+ }
+
+ @Test
+ public void diceResults2(){
+ SnakesAndLadders snakesAndLadders = new SnakesAndLadders();
+ SnakesLaddersPiece piece = new SnakesLaddersPiece();
+ Integer roll = 6;
+ Integer expected = roll + piece.getCurrentPosition();
+ Integer actual = snakesAndLadders.diceResults(roll,false);
+ Assert.assertEquals(expected,actual);
+ }
+}
diff --git a/src/test/java/io/zipcoder/casino/Menus/CasinoTest.java b/src/test/java/io/zipcoder/casino/Menus/CasinoTest.java
new file mode 100644
index 000000000..3cc7f92d3
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/Menus/CasinoTest.java
@@ -0,0 +1,18 @@
+package io.zipcoder.casino.Menus;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class CasinoTest {
+
+
+
+ @Test
+ public void testRunCasinoMenu() {
+ }
+
+ @Test
+ public void testCasinoMenuLogic() {
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/Menus/GameMenuTest.java b/src/test/java/io/zipcoder/casino/Menus/GameMenuTest.java
new file mode 100644
index 000000000..6cf375766
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/Menus/GameMenuTest.java
@@ -0,0 +1,16 @@
+package io.zipcoder.casino.Menus;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class GameMenuTest {
+
+ @Test
+ public void runGameMenu() {
+ }
+
+ @Test
+ public void gameMenuLogic() {
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/PlayerMenuTest.java b/src/test/java/io/zipcoder/casino/PlayerMenuTest.java
new file mode 100644
index 000000000..dc5194d4c
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/PlayerMenuTest.java
@@ -0,0 +1,21 @@
+package io.zipcoder.casino;
+
+import io.zipcoder.casino.PlayerCreation.Player;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class PlayerMenuTest {
+
+
+ @Test
+ public void createPlayerTest(){
+
+ }
+ @Test
+ public void runPlayerMenu() {
+ }
+
+ @Test
+ public void playerMenuLogic() {
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/io/zipcoder/casino/PlayerRepositoryTest.java b/src/test/java/io/zipcoder/casino/PlayerRepositoryTest.java
new file mode 100644
index 000000000..e11d88bb7
--- /dev/null
+++ b/src/test/java/io/zipcoder/casino/PlayerRepositoryTest.java
@@ -0,0 +1,60 @@
+package io.zipcoder.casino;
+
+import io.zipcoder.casino.PlayerCreation.Player;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.HashMap;
+
+import static org.junit.Assert.*;
+
+public class PlayerRepositoryTest {
+
+ @Test
+ public void findPlayerTest1() {
+ PlayerRepository repository = new PlayerRepository();
+ Player sabin = new Player("Terra", 500);
+ repository.addPlayer(sabin);
+ Player actual = repository.findPlayer("Terra");
+
+ assertEquals(actual.getBalance(), sabin.getBalance());
+ }
+
+ @Test
+ public void findPlayerTest2() {
+ PlayerRepository repository = new PlayerRepository();
+ Player sabin = new Player("Sabin", null);
+ repository.addPlayer(sabin);
+ Player actual = repository.findPlayer("Sabin");
+
+ assertEquals(actual.getName(), sabin.getName());
+ }
+
+ @Test
+ public void addPlayerTest1() {
+ PlayerRepository repository = new PlayerRepository();
+ Player cyan = new Player("Cyan", null);
+
+
+ Assert.assertTrue(repository.addPlayer(cyan));
+ }
+
+ @Test
+ public void addPlayerTest2() {
+ PlayerRepository repository = new PlayerRepository();
+ Player cyan = new Player("Cyan", null);
+
+
+ Assert.assertTrue(repository.addPlayer(cyan));
+ }
+
+ @Test
+ public void constructorTest(){
+ PlayerRepository repository = new PlayerRepository();
+ Player cyan = new Player("Cyan", null);
+ repository.addPlayer(cyan);
+
+
+ Assert.assertFalse(repository.addPlayer(cyan));
+ }
+}
\ No newline at end of file