Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project submission from team Greg, Abe and Xiong #26

Open
wants to merge 97 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
d196e7c
puml file
Mar 15, 2021
1d82d4b
updated UML
Mar 15, 2021
d04315d
GamblingGame interface made. DiceGame abstract class made
Mar 15, 2021
369dc2e
dice tests written for current methods
Mar 15, 2021
3b9ad1a
added craps class and tests for methods of MostOfAKind and Craps
Mar 15, 2021
6672193
added fields to MostOfAKind
Mar 15, 2021
aafde54
updated uml. added main class. Casino class has run method
Mar 15, 2021
b4685c3
added checkwinner boolean
Mar 15, 2021
16a6c4b
mostofakind tests updated. mostofakind bug fixes. Chipmoneyexchange w…
Mar 15, 2021
09e5a14
Game CardGame and Card classes complete
Mar 15, 2021
0179eff
Merge pull request #1 from xyuan04/abby
Abielf Mar 15, 2021
6a915eb
created player, playerwarehouse, playerfactory
xyuan04 Mar 15, 2021
e433428
upgraded CardGame Class
Mar 16, 2021
b228b81
Merge pull request #3 from xyuan04/abby
Abielf Mar 16, 2021
f87dc55
minor comments added for documentation purposes
Mar 16, 2021
1e5847f
cards work now lol
Mar 16, 2021
8e63742
Merge pull request #4 from xyuan04/abby
Abielf Mar 16, 2021
dc7f247
Boolean
Mar 16, 2021
193e7c1
Merge pull request #5 from xyuan04/abby
Abielf Mar 16, 2021
60cfa6e
updated a bunch of stuff
xyuan04 Mar 16, 2021
9246c79
craps should be fully written, passing all tests
Mar 16, 2021
f4a6f94
updated MostOfAKind and tests. Includes more getters and methods to m…
Mar 16, 2021
8e5b3ef
updated blackjack
xyuan04 Mar 16, 2021
1b5383c
MostOfAKind should be done and tests are written
Mar 16, 2021
ba8c771
Merge branch 'master' of github.com:xyuan04/Maven.Casino into Gerg
Mar 16, 2021
15a7e72
updated the CardGame class
Mar 16, 2021
468e215
Merge pull request #8 from xyuan04/abby
Abielf Mar 16, 2021
b4ec41c
Merge branch 'master' of github.com:xyuan04/Maven.Casino into Gerg
Mar 16, 2021
c45f963
starting screens. ascii art class if I can figure it out, if not, I'l…
Mar 16, 2021
5be9a12
finished BlackJack
xyuan04 Mar 16, 2021
d1fcb71
working on teller screen
Mar 16, 2021
a54181e
Merge branch 'master' of github.com:xyuan04/Maven.Casino into Gerg
Mar 16, 2021
85b9bc8
teller screen added
Mar 16, 2021
2118050
override toString in Card
xyuan04 Mar 16, 2021
14eb2a8
made a Display super class with some subclasses for casino lobby, cra…
Mar 16, 2021
ecba965
Merge branch 'master' of github.com:xyuan04/Maven.Casino
Mar 16, 2021
ddd5a05
took stuff out of casino that I was testing
Mar 16, 2021
7de5a41
ALMOST DONE
Mar 16, 2021
7781aec
Merge pull request #11 from xyuan04/abby
Abielf Mar 16, 2021
210acfe
added initialize players in PlayerWarehouse and started on BlackJack …
xyuan04 Mar 16, 2021
6030d47
MOAK and Craps screens all made. Added insufficientChips screen to Di…
Mar 17, 2021
6e7a7cd
Merge branch 'master' of github.com:xyuan04/Maven.Casino
Mar 17, 2021
3785682
added checks for blackjack and busts + wrote tests
xyuan04 Mar 17, 2021
95d0b91
updated BlackJack game
xyuan04 Mar 17, 2021
2a36e77
changed checkwinner for you Xiong
Mar 17, 2021
681a8b7
Merge pull request #15 from xyuan04/abby
Abielf Mar 17, 2021
2e77c9d
updated initializePlayers and added deck reset in blackjack engine
xyuan04 Mar 17, 2021
0c1df07
screens and ish
Mar 17, 2021
8063ee7
changed gameWinner checks on BlackJack
xyuan04 Mar 17, 2021
e39cfbb
Merge branch 'master' of github.com:xyuan04/Maven.Casino
Mar 17, 2021
2c0b583
works through rollTheDice screen
Mar 17, 2021
b87ad4a
working my way through crapsEngine
Mar 17, 2021
68e1711
FINISHED blackjack engine and fixed blackjackchecker tests
xyuan04 Mar 17, 2021
5cc42a8
added a check for negative bet amounts
xyuan04 Mar 17, 2021
4977493
CrapsEngine works with the placeholders for now
Mar 17, 2021
ff1247f
Merge branch 'master' of github.com:xyuan04/Maven.Casino
Mar 17, 2021
569e375
Working my way through MOAK engine
Mar 17, 2021
264ae73
working version of MOAK. Need to implement Dealer AI
Mar 17, 2021
bf2638e
WOOOOO playable gofish build
Mar 17, 2021
fb55331
Merge pull request #20 from xyuan04/abby
Abielf Mar 17, 2021
4a39854
ALMOST fully functioning MOAK. Dealer count to determine winner messe…
Mar 17, 2021
1c2abbe
MostOfAKind works!!!!
Mar 17, 2021
a4ce854
Merge branch 'master' of github.com:xyuan04/Maven.Casino
Mar 17, 2021
fc3a402
some edits for cleaner messages
Mar 17, 2021
09ed115
Merge pull request #21 from xyuan04/abby
Abielf Mar 17, 2021
d7e4215
We need to flesh out how to call on the engines to run each game. I'm…
Mar 18, 2021
1c62e64
added AI for dealer and organized BlackJackEngine class
xyuan04 Mar 18, 2021
efc13b4
Go fish DONE
Mar 18, 2021
10e0a3c
Merge pull request #23 from xyuan04/abby
Abielf Mar 18, 2021
09fcd9d
finalized BlackJackEngine, changed Ace Cards to be public
xyuan04 Mar 18, 2021
a1df845
fixed BlackJackEngine to be able to exit
xyuan04 Mar 18, 2021
e4d5d8a
need to break out of craps
Mar 18, 2021
95d3d1c
actually fixed BlackJackEngine
xyuan04 Mar 18, 2021
8b1b679
bug fix on BJE
xyuan04 Mar 19, 2021
f019388
Integrated games. This version has bugs in GoFish
gregdon13 Mar 19, 2021
45cc8f6
ALL DONE GO FISH
Mar 19, 2021
3be777c
Merge pull request #29 from xyuan04/abby
Abielf Mar 19, 2021
6247552
refactored BlackJackEngine
xyuan04 Mar 19, 2021
8bd39e3
teller window fixed
gregdon13 Mar 19, 2021
3d78a90
removed bet method from player
xyuan04 Mar 19, 2021
2c84b28
minor user prompt edits
Mar 19, 2021
6e538d1
Merge pull request #33 from xyuan04/abby
Abielf Mar 19, 2021
467fdc5
just keep runnin runnin and runnin
Mar 19, 2021
b94ee21
Merge branch 'master' of github.com:xyuan04/Maven.Casino
Mar 19, 2021
f4155ad
craps is not infinite anymore
Mar 19, 2021
bbbe1ea
it never ends
Mar 19, 2021
d14fa71
teller window fixed
gregdon13 Mar 19, 2021
e44c5cc
teller window shows wallet and chip balance
gregdon13 Mar 19, 2021
d136d8b
updated casino and refactored code
xyuan04 Mar 19, 2021
4b7c187
Merge pull request #39 from xyuan04/abby
Abielf Mar 19, 2021
656f7f6
final final final final final push
Mar 19, 2021
3f2bb9a
minor fixes
xyuan04 Mar 19, 2021
36cd1e7
setting status
Mar 19, 2021
9c12b53
shorter lines
Mar 19, 2021
78ceb3f
Gerg FINALE
Mar 19, 2021
9707b12
Merge pull request #42 from xyuan04/Gerg
gregdon13 Mar 19, 2021
943ad5f
refactored BlackJack
xyuan04 Mar 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 179 additions & 0 deletions Casino.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
@startuml
'https://plantuml.com/sequence-diagram

class PlayerClass {
private String playerName;
private final int playerID;
private int wallet;
private int chipBalance;

get/setter name;
get ID;
get/set chipBalance;
get/set wallet;
addToWallet;

wageMoney;
cashOut;
getMoreChips;
}

interface Game {
playGame;
checkWinner;
}

interface GamblingGame {
addToPot;
winPot;
}

interface GamblingPlayer {
wageMoney;
cashOut;
getMoreChips;
}

abstract class CardGame {
private ArrayList<Cards> deck;
private ArrayList<Cards> discardPile;
private ArrayList<Cards> playerHand;
private ArrayList<Cards> dealerHand;

playGame;
checkWinner;
makeDeck;
shuffleDeck;
dealCards;
discardPile;
}

abstract class DiceGame {
private int totalNumOfDice;
ArrayList<Integers> playerDiceHand;
int sizeOfPot;

playGame;
checkWinner;
addToPot;
winPot;
rollDice;
}

class ChipMoneyExchange {
chipsToMoney;
moneyToChips;
}

class GoFish {
ArrayList<Cards> playerHand;
ArrayList<Cards> dealerHand;
int numOfPlayerMatches;
int numOfDealerMatches;

doYouHaveCard;
removeCardFromHand;
addToPlayerMatches;
addToDealerMatches;
checkWinner;
}

class BlackJack {
ArrayList<Cards> playerHand;
ArrayList<Cards> playerSplitHand;
ArrayList<Cards> dealerHand;
ArrayList<Cards> dealerSplitHand;
int playerTotal;
int dealerTotal;
int sizeOfPot;

addToPot;
winPot;
checkWinner;
splitHand;
hitMe;
(boolean)didIBust;
}

class Craps {
String stateOfGame(passOrNot);
int currentRound;
}

class ExtraDiceGame {
ArrayList<Integer> dealerDiceHand;
int playerCount;
int dealerCount;

countMatches;
checkWinner;
holdDice(int... index);
}

class PlayerWarehouse {
HashSet<UserID, player> currentPlayers;

addPlayer;
removePlayer;
howManyPlayers;
}

class PlayerFactory {
createPlayer;
}

class CardFactory {
createCard;
}


class CardMaker {
private String nameOfCard;
private String suitOfCard;
private int valueOfCard;
}

class Display {
enterCasinoScreen;
chipMoneyExchangeScreen;
chooseGameScreen;
goFish(all the screens);
blackJack(all the screens);
craps(all the screens);
extraDiceGame(all the screens);
}

class cardWarehouse {
ArrayList<Cards> deckOfCards;
}


class MainCasino {
runCasino;
}

DiceGame <|--- Craps
DiceGame <|--- ExtraDiceGame

CardGame <|--- GoFish
CardGame <|--- BlackJack

Game <|--- GamblingGame


GamblingGame <|--- BlackJack
GamblingGame <|--- DiceGame

GamblingPlayer <|-- PlayerClass

Game <|-- CardGame



'Alice -> Bob: Authentication Request
'Bob --> Alice: Authentication Response
'
'Alice -> Bob: Another authentication Request
'Alice <-- Bob: another authentication Response

@enduml
24 changes: 24 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
<groupId>io.zipcoder</groupId>
<artifactId>casino</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
Expand All @@ -15,5 +27,17 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
122 changes: 122 additions & 0 deletions src/main/java/io/zipcoder/casino/CardGames/BlackJack.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package io.zipcoder.casino.CardGames;

import io.zipcoder.casino.GamblingGame;
import io.zipcoder.casino.Player.Player;

import java.util.ArrayList;
import java.util.List;

public class BlackJack extends CardGame implements GamblingGame {
public Player currentPlayer;
public List<Card> playerHand = new ArrayList<>();
public List<Card> dealerHand = new ArrayList<>();
public List<Card> playerSplitHand = new ArrayList<>();
public List<Card> currentHand = playerHand;
public int playerTotal;
public int playerSplitTotal;
public int dealerTotal;
public int sizeOfPot;

public BlackJack(Player currentPlayer) { this.currentPlayer = currentPlayer; }

public void addToPot(int chipsAdded) {
currentPlayer.wageMoney(chipsAdded);
sizeOfPot += chipsAdded;
}

public void passPot(int multiplier) {
currentPlayer.winChips(getPot()*multiplier);
sizeOfPot = 0;
currentHand = playerHand;
}

public void hitMe() {
dealCards(currentHand);
int currentValue = 0;
if(currentHand == playerHand) {
for(int i = 0; i < playerHand.size(); i++) {
currentValue += playerHand.get(i).getValue();
}
playerTotal = currentValue;
} else if(currentHand == playerSplitHand) {
for(int i = 0; i < playerSplitHand.size(); i++) {
currentValue += playerSplitHand.get(i).getValue();
}
playerSplitTotal = currentValue;
} else if(currentHand == dealerHand) {
for(int i = 0; i < dealerHand.size(); i++) {
currentValue += dealerHand.get(i).getValue();
}
dealerTotal = currentValue;
}
}

public void hold() {
if(currentHand == playerHand && playerSplitHand.size() == 2) {
currentHand = playerSplitHand;
} else if (currentHand == playerSplitHand) {
currentHand = dealerHand;
} else currentHand = dealerHand;
}

@Override
public void playGame() {
makeDeck();
shuffleDeck();
for(int i = 0; i < 2; i++) {
dealCards(playerHand);
playerTotal += playerHand.get(i).getValue();
dealCards(dealerHand);
dealerTotal += dealerHand.get(i).getValue();
}
}

@Override
public String checkWinner() {
if(playerTotal > dealerTotal && playerTotal <= 21 || playerSplitTotal > dealerTotal && playerSplitTotal <= 21) return "Player";
else if(dealerTotal > 21) return "Player";
else if(playerTotal > 21 && playerSplitTotal > 21) return "Dealer";
else if(playerTotal > 21 && dealerTotal > playerSplitTotal) return "Dealer";
else if(dealerTotal == 21 && playerTotal != 21 && playerSplitTotal != 21) return "Dealer";
else if ((dealerTotal > playerTotal || playerTotal > 21) && (dealerTotal > playerSplitTotal || playerSplitTotal > 21)) return "Dealer";
else return "Tie";
}

public void playerHandSplit() {
addToPot(sizeOfPot);

playerTotal -= playerHand.get(0).getValue();
playerSplitHand.add(playerHand.remove(0));
playerSplitTotal += playerSplitHand.get(0).getValue();

dealCards(playerHand);
playerTotal += playerHand.get(1).getValue();
dealCards(playerSplitHand);
playerSplitTotal += playerSplitHand.get(1).getValue();
}

public String blackJackCheck() {
if (dealerTotal == 21 && dealerHand.size() == 2 && (playerTotal == 21 && playerHand.size() == 2 || playerSplitTotal == 21 && playerSplitHand.size() == 2)) {
return "Tie";
} else if (playerTotal == 21 && playerHand.size() == 2 || playerSplitTotal == 21 && playerSplitHand.size() == 2) {
return "Player";
} else if (dealerTotal == 21 && dealerHand.size() == 2)
return "Dealer";
else return "None";
}

public boolean dealerHaveBlackJack() {
if (dealerTotal == 21 && (dealerHand.get(0).getCardName().equals("A") || dealerHand.get(1).getCardName().equals("A"))) {
return true;
} return false;
}

public boolean playerBust() { return playerTotal > 21; }

public boolean playerSplitHandBust() { return playerSplitTotal > 21; }

public boolean dealerBust() { return dealerTotal > 21; }

@Override
public int getPot() { return sizeOfPot; }
}
Loading