Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
f5292a7
add comments
dimaromaniv Jul 17, 2023
66fe966
testing merging to our group casino fork
Jul 17, 2023
9e3d6cd
Test
Minsoo5 Jul 17, 2023
139b9d7
pr test
oahmed105 Jul 17, 2023
0fcab46
Merge pull request #1 from ctgao/master
ctgao Jul 17, 2023
1208081
Merge pull request #2 from Minsoo5/master
ctgao Jul 17, 2023
1dbd6f4
testing
Danielle-Greene Jul 17, 2023
a272a58
Merge pull request #3 from oahmed105/master
ctgao Jul 17, 2023
2206dbc
check
dimaromaniv Jul 17, 2023
313b216
Merge pull request #4 from Danielle-Greene/master
ctgao Jul 17, 2023
6456987
Merge pull request #5 from dimaromaniv/master
ctgao Jul 17, 2023
e570fbd
UML Uploaded
Danielle-Greene Jul 17, 2023
36a0c79
Merge pull request #6 from Danielle-Greene/master
ctgao Jul 17, 2023
de16a87
did some cleanup and got the UML
Jul 17, 2023
61b2064
Merge pull request #7 from ctgao/master
ctgao Jul 17, 2023
f3673ba
Added the updated UML
Minsoo5 Jul 18, 2023
94d302a
Merge pull request #8 from Minsoo5/master
ctgao Jul 18, 2023
8825fff
Added V3 UML
Minsoo5 Jul 18, 2023
04e547b
Merge pull request #9 from Minsoo5/master
ctgao Jul 18, 2023
67c1223
ulm update
dimaromaniv Jul 19, 2023
b6aaada
Merge pull request #10 from dimaromaniv/master
ctgao Jul 19, 2023
3676383
kjhgk
dimaromaniv Jul 19, 2023
b4f99d7
wrote some basic enums for the playing card suit and playing card value
Jul 19, 2023
24cb5b0
Casino Account and Tests Done
Minsoo5 Jul 19, 2023
11fea92
Delete .DS_Store
Minsoo5 Jul 19, 2023
99b8e05
Add constructor
dimaromaniv Jul 19, 2023
a9a287f
Oopsy Files Gone
Minsoo5 Jul 19, 2023
0a4cab0
Merge branch 'master' of https://github.com/Casino-Chaching/GroupCasino
dimaromaniv Jul 19, 2023
fe6c72f
Merge pull request #12 from Minsoo5/master
ctgao Jul 19, 2023
235ea63
Still need to work on HouseAccout tests
oahmed105 Jul 19, 2023
35499b0
finished card and test
Jul 19, 2023
873d406
Merge pull request #13 from oahmed105/master
ctgao Jul 19, 2023
5b64989
Merge branch 'master' of github.com:Casino-Chaching/GroupCasino
Jul 19, 2023
89bfc74
deleted the old UML
Jul 19, 2023
48669bf
Merge pull request #14 from ctgao/master
ctgao Jul 19, 2023
0d5da2e
wrote the deck and it extends stack omg
Jul 20, 2023
a7c5b5b
Merge pull request #15 from ctgao/master
ctgao Jul 20, 2023
9a41931
i forgot to push these changes?
Jul 20, 2023
18225fa
Merge branch 'master' of github.com:Casino-Chaching/GroupCasino
Jul 20, 2023
5b9318e
created the hand of cards
Jul 20, 2023
f170280
wrote a couple of tests, just wanted to understand exactly how the Ha…
Jul 20, 2023
630eb41
Hand of cards is complete and tested
Jul 20, 2023
77c7d17
Merge pull request #16 from ctgao/master
ctgao Jul 20, 2023
5b271fe
GameInterface filled in
Minsoo5 Jul 20, 2023
4381a27
Added in GamblerInterface
Minsoo5 Jul 20, 2023
4a66a54
Merge pull request #17 from Minsoo5/master
ctgao Jul 20, 2023
76183a4
HouseAccount and HouseAccountTest completed
oahmed105 Jul 20, 2023
70f437a
GambleGameInterface added
Minsoo5 Jul 20, 2023
c9fc01a
GambleGameInterface added
Minsoo5 Jul 20, 2023
e165af8
HouseAccount and HouseAccountTest completed
oahmed105 Jul 20, 2023
0f0f6da
Merge remote-tracking branch 'origin/master'
Minsoo5 Jul 20, 2023
dc36ea6
Merge remote-tracking branch 'origin/master'
oahmed105 Jul 20, 2023
41cb528
some changes with playerClass
dimaromaniv Jul 20, 2023
fd57c4e
Merge pull request #19 from oahmed105/master
ctgao Jul 20, 2023
835d089
Merge pull request #18 from Minsoo5/master
ctgao Jul 20, 2023
f0e284c
just commiting simple card game and card player stuff
Jul 20, 2023
88b8165
Merge branch 'master' of github.com:Casino-Chaching/GroupCasino
Jul 20, 2023
ad6363e
Merge branch 'master' into master
dimaromaniv Jul 20, 2023
51af5d6
Merge pull request #20 from Minsoo5/master
ctgao Jul 20, 2023
72020e6
Update MainApplication.java
ctgao Jul 20, 2023
77e74cd
Merge pull request #21 from dimaromaniv/master
ctgao Jul 20, 2023
3ab94d5
finished typing up card player
Jul 20, 2023
5184c1c
Merge branch 'master' of github.com:Casino-Chaching/GroupCasino
Jul 20, 2023
b8d1a6f
committing to pull
Danielle-Greene Jul 20, 2023
c08e0b5
Merge branch 'master' into master
ctgao Jul 20, 2023
3797a32
Merge pull request #24 from ctgao/master
ctgao Jul 20, 2023
fbdc220
edited minor things
Jul 20, 2023
c92ed01
Merge branch 'master' of github.com:Casino-Chaching/GroupCasino
Jul 20, 2023
e51b8cb
just some file cleaning up - making sure all references are correct -…
Jul 20, 2023
fa857f7
Merge pull request #25 from ctgao/master
ctgao Jul 20, 2023
f162a20
Saving Roulette Work
Minsoo5 Jul 20, 2023
912125c
commit
oahmed105 Jul 20, 2023
61e713d
finished up card player and some other things
Jul 20, 2023
fc798c3
Merge pull request #27 from ctgao/master
ctgao Jul 20, 2023
5e062cc
NumberGuessPlayer and NumberGuessPlayer tests completed
oahmed105 Jul 20, 2023
53403d0
RouletteNum Enums Set ;)
Minsoo5 Jul 20, 2023
df965d9
enums
Minsoo5 Jul 20, 2023
8d60f65
finished up card player and some other things
Jul 20, 2023
b863975
Merge pull request #29 from Minsoo5/master
ctgao Jul 20, 2023
a8b1576
Merge branch 'master' into master
ctgao Jul 20, 2023
b94693b
Merge pull request #28 from oahmed105/master
ctgao Jul 20, 2023
df87d5c
check
dimaromaniv Jul 21, 2023
3886e73
Test
dimaromaniv Jul 21, 2023
acb897e
made some critical changes to Card stuff
Jul 21, 2023
1adfc87
started working on blackjack
Jul 21, 2023
c215327
Merge pull request #30 from Casino-Chaching/christine
ctgao Jul 21, 2023
1d58bcb
Finished one thing but added many more problems
oahmed105 Jul 21, 2023
ed7520d
finished writing blackjack game i think
Jul 21, 2023
97cf83d
had to make some changes to the casino account
Jul 21, 2023
7f51f0b
implemented casino account manager stuff last minute and made tweaks …
Jul 21, 2023
295770b
Merge pull request #31 from Casino-Chaching/osamasBranch
ctgao Jul 21, 2023
acc7d0d
Update SlotsGame.java
dimaromaniv Jul 21, 2023
355e803
merging master into christine
Jul 21, 2023
2e12a65
now we can make account and kinda play number guess game
Jul 21, 2023
f867b6f
something went wrong
dimaromaniv Jul 21, 2023
6efbb9f
made sure the house account can communicate with the games
Jul 21, 2023
94abe87
Merge pull request #32 from Casino-Chaching/master
dimaromaniv Jul 21, 2023
208381d
made some minor changes
Jul 21, 2023
ecc3806
made sure singleton is good
Jul 21, 2023
97371d6
i need help
dimaromaniv Jul 21, 2023
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -560,3 +560,6 @@ healthchecksdb
MigrationBackup/

# End of https://www.gitignore.io/api/eclipse,intellij,netbeans,notepadpp,sublimetext,visualstudio

# need to ignore
.DS_Store
Binary file added Casino Cha-Chain UML.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/main/java/com/github/zipcodewilmington/Casino.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public void run() {
if (isValidLogin) {
String gameSelectionInput = getGameSelectionInput().toUpperCase();
if (gameSelectionInput.equals("SLOTS")) {
play(new SlotsGame(), new SlotsPlayer());
play(new SlotsGame(), new SlotsPlayer(casinoAccount,console));
} else if (gameSelectionInput.equals("NUMBERGUESS")) {
play(new NumberGuessGame(), new NumberGuessPlayer());
play(new NumberGuessGame(), new NumberGuessPlayer(casinoAccount, console));
} else {
// TODO - implement better exception handling
String errorMessage = "[ %s ] is an invalid game selection";
Expand Down
49 changes: 49 additions & 0 deletions src/main/java/com/github/zipcodewilmington/casino/CardGame.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.github.zipcodewilmington.casino;

import com.github.zipcodewilmington.casino.cardutils.TheDeck;

import java.util.ArrayList;
import java.util.HashMap;

public abstract class CardGame implements GameInterface{
ArrayList<CardPlayer> players;
TheDeck theDeck;
HashMap<CardPlayer, Integer> playerScores;

// Constructors
public CardGame() {
players = new ArrayList<>();
theDeck = new TheDeck();
playerScores = new HashMap<>();
}

public TheDeck getTheDeck() {
return theDeck;
}

public ArrayList<CardPlayer> getPlayers() {
return players;
}

@Override
public void add(PlayerInterface player) {
players.add((CardPlayer) player);
playerScores.put((CardPlayer) player, 0);
}

@Override
public void remove(PlayerInterface player) {
players.remove((CardPlayer) player);
playerScores.remove((CardPlayer) player);
}

public void dealCards(int cardsForEach){
for(int i = 0; i < cardsForEach; i++){
// each round of dealing
for(CardPlayer cp : players){
// for each player, give one card
cp.receiveCard(theDeck.drawCard());
}
}
}
}
83 changes: 83 additions & 0 deletions src/main/java/com/github/zipcodewilmington/casino/CardPlayer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.github.zipcodewilmington.casino;

import com.github.zipcodewilmington.casino.cardutils.*;
import com.github.zipcodewilmington.utils.IOConsole;

import java.util.Scanner;

public abstract class CardPlayer extends PlayerClass{
HandOfCards curHand;

// Constructor
public CardPlayer(CasinoAccount wallet, IOConsole console){
super(wallet, console);
curHand = new HandOfCards();
}
public CardPlayer(HandOfCards hand){
super(null, null);
curHand = hand;
}

// my other functions
public HandOfCards getHandOfCards(){
return curHand;
}

public void receiveCard(PlayingCard pc){
curHand.addCard(pc);
}

public void useCard(PlayingCard pc){
curHand.removeCard(pc);
}

public void printHand(){
// not sure what to put here yet so i'll leave it empty for now
super.printToConsole(curHand.toString());
}

public void clearHand(){
curHand.clear();
}

public PlayingCard promptForCard(String prompt){
String response = super.promptPlayerForChoice(prompt);
String[] cardPieces = response.toUpperCase().split(" ");

PlayingCardValue pcv = parseCardValue(cardPieces);
PlayingCardSuit pcs = parseCardSuit(cardPieces);

if(pcv == null || pcs == null){
// or some exception??? dunno yet
return null;
}
return new PlayingCard(pcs, pcv);
}

private PlayingCardSuit parseCardSuit(String[] cardPieces) {
for(String s : cardPieces){
// iterating through the stuff split into spaces
for(PlayingCardSuit suit : PlayingCardSuit.values()){
if(s.equals(suit.name())){
return suit;
}
}
}
return null;
}

private PlayingCardValue parseCardValue(String[] cardPieces) {
for(String s : cardPieces){
// iterating through the stuff split into spaces
for(PlayingCardValue value : PlayingCardValue.values()){
if(s.equals(value.toString())){
return value;
}
}
}
return null;
}

// abstract functions here
public abstract void sortHand();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,34 @@
* The `ArcadeAccount` is used to log into the system to select a `Game` to play.
*/
public class CasinoAccount {
}

private String accOwner;
private String accPassword;
private int accBalance;

public CasinoAccount(String accOwner, String accPassword, int accBalance){
this.accOwner = accOwner;
this.accPassword = accPassword;
this.accBalance = accBalance;
}

public int getAccBalance() {return this.accBalance;}

public void setAccBalance(int accBalance) {
this.accBalance = accBalance;
}

public String getAccOwner() {return this.accOwner;}

public void updateAccBalance(int winnings) {
this.accBalance = this.accBalance + winnings;
}

public String getAccPassword() {
return accPassword;
}

public void setAccPassword(String accPassword) {
this.accPassword = accPassword;
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
package com.github.zipcodewilmington.casino;

import java.util.ArrayList;
import java.util.HashMap;

/**
* Created by leon on 7/21/2020.
* `ArcadeAccountManager` stores, manages, and retrieves `ArcadeAccount` objects
* it is advised that every instruction in this class is logged
*/
public class CasinoAccountManager {
HashMap<String, CasinoAccount> listOfAccounts = new HashMap<>();
public HashMap<String, CasinoAccount> getListOfAccounts() {
return listOfAccounts;
}

/**
* @param accountName name of account to be returned
* @param accountPassword password of account to be returned
* @return `ArcadeAccount` with specified `accountName` and `accountPassword`
*/
public CasinoAccount getAccount(String accountName, String accountPassword) {
String currentMethodName = new Object(){}.getClass().getEnclosingMethod().getName();
String currentClassName = getClass().getName();
String errorMessage = "Method with name [ %s ], defined in class with name [ %s ] has not yet been implemented";
throw new RuntimeException(String.format(errorMessage, currentMethodName, currentClassName));
// String currentMethodName = new Object(){}.getClass().getEnclosingMethod().getName();
// String currentClassName = getClass().getName();
// String errorMessage = "Method with name [ %s ], defined in class with name [ %s ] has not yet been implemented";
// throw new RuntimeException(String.format(errorMessage, currentMethodName, currentClassName));
if(listOfAccounts.containsKey(accountName)){
if(listOfAccounts.get(accountName).getAccPassword().equals(accountPassword)){
return listOfAccounts.get(accountName);
}
}
String errorMessage = "There is no account with this name and password!";
throw new RuntimeException(errorMessage);
}

/**
Expand All @@ -26,10 +41,13 @@ public CasinoAccount getAccount(String accountName, String accountPassword) {
* @return new instance of `ArcadeAccount` with specified `accountName` and `accountPassword`
*/
public CasinoAccount createAccount(String accountName, String accountPassword) {
String currentMethodName = new Object(){}.getClass().getEnclosingMethod().getName();
String currentClassName = getClass().getName();
String errorMessage = "Method with name [ %s ], defined in class with name [ %s ] has not yet been implemented";
throw new RuntimeException(String.format(errorMessage, currentMethodName, currentClassName));
// String currentMethodName = new Object(){}.getClass().getEnclosingMethod().getName();
// String currentClassName = getClass().getName();
// String errorMessage = "Method with name [ %s ], defined in class with name [ %s ] has not yet been implemented";
// throw new RuntimeException(String.format(errorMessage, currentMethodName, currentClassName));
CasinoAccount ca = new CasinoAccount(accountName, accountPassword, 1_000);
listOfAccounts.put(accountName, ca);
return ca;
}

/**
Expand All @@ -38,9 +56,10 @@ public CasinoAccount createAccount(String accountName, String accountPassword) {
* @param casinoAccount the arcadeAccount to be added to `this.getArcadeAccountList()`
*/
public void registerAccount(CasinoAccount casinoAccount) {
String currentMethodName = new Object(){}.getClass().getEnclosingMethod().getName();
String currentClassName = getClass().getName();
String errorMessage = "Method with name [ %s ], defined in class with name [ %s ] has not yet been implemented";
throw new RuntimeException(String.format(errorMessage, currentMethodName, currentClassName));
// String currentMethodName = new Object(){}.getClass().getEnclosingMethod().getName();
// String currentClassName = getClass().getName();
// String errorMessage = "Method with name [ %s ], defined in class with name [ %s ] has not yet been implemented";
// throw new RuntimeException(String.format(errorMessage, currentMethodName, currentClassName));
listOfAccounts.put(casinoAccount.getAccOwner(), casinoAccount);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.github.zipcodewilmington.casino;

public interface GambleGameInterface {

int payOutCalc(int betAmount, int payOutMult);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.github.zipcodewilmington.casino;

public interface GamblerInterface {

int makeBet(int bet);

boolean validBet(int bet);

//The winnings from a bet going into the player's wallet
void depositPayOut(int winnings);


}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ public interface GameInterface extends Runnable {
* specifies how the game will run
*/
void run();

void printWinner();

boolean isEndCondition();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.github.zipcodewilmington.casino;

public class HouseAccount {

private static HouseAccount houseAccount;
private int accBalance;

private HouseAccount() {
accBalance = 1_000_000;
}

public static synchronized HouseAccount getHouseAccount() {
if (houseAccount == null) {
houseAccount = new HouseAccount();
}
return houseAccount;
}

public int getBalance() {
return this.accBalance;}

public int payout(int losses) {
//Casino is losing money
this.accBalance = accBalance - losses;
return losses;
}

public void acceptMoney(int winnings) {
//Casino is gaining money
this.accBalance = accBalance + winnings;
}

}
Loading