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

John branch #45

Open
wants to merge 98 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
d246769
created branch junior
Nov 15, 2021
58a09a7
created new branch
Nov 15, 2021
26449de
Created new branch
Nov 15, 2021
97601bd
added todo
Nov 15, 2021
c28d51f
rough
Nov 15, 2021
7a99c8c
added Roulette classes
Nov 15, 2021
aca5f97
updates
Nov 16, 2021
76d5bc7
added Roulette menu
Nov 16, 2021
541eb99
merge test
Nov 16, 2021
5ab9a24
Merge branch 'Junior' into master
Roggam Nov 16, 2021
233c8f9
Merge pull request #1 from TeamTripleJJJ/master
Roggam Nov 16, 2021
d4d5637
test merge
Nov 16, 2021
ca80235
fixed conflic
Nov 16, 2021
fe34abf
Casino Account class created
Nov 17, 2021
5361d01
previous slots game and new WAR game start
Nov 17, 2021
01af3c6
working on account
Nov 17, 2021
dcc6490
added JRs changes
Nov 17, 2021
ef2dfc8
merged
Nov 17, 2021
48fa3b0
changes
Nov 17, 2021
312636c
adding logic to rouletteGame
Nov 17, 2021
ba98e47
Added the blackjack classes.
Nov 17, 2021
9edbf9f
various changes w War game
Nov 17, 2021
e177f52
testing how to get access to account balance
Nov 17, 2021
8857d91
added loop to Roulette Menu
Nov 17, 2021
170a4c6
organizing and testing methods
Nov 18, 2021
2bb5784
minor change
Nov 18, 2021
ef5837f
fixed rules method
Nov 18, 2021
a16913c
cards are working
Nov 18, 2021
9a4e000
updated
Nov 18, 2021
31bf5ef
fixed random number issue with leon
Nov 18, 2021
b047f8c
minor text change
Nov 18, 2021
1f01cc1
changes
Nov 18, 2021
08cb109
change
Nov 18, 2021
dac1373
added War back
Nov 18, 2021
b077d44
some changes to prog
Nov 18, 2021
0e33dbd
updated
Nov 18, 2021
1bbfdc1
minor changes
Nov 19, 2021
c9097fc
finished game kind of
Nov 19, 2021
f294dfd
added wager functionality
Nov 19, 2021
e3c9b15
removed for loop in red and black and added 14 tests
Nov 19, 2021
7f8b575
Added more functionality to game
Nov 19, 2021
1f3ee9a
changes
Nov 19, 2021
20acfe5
tests
Nov 19, 2021
d5c582d
fixed some bugs
Nov 19, 2021
b46df9d
finished game
Nov 19, 2021
81058c9
Almost done
Nov 19, 2021
dc94537
fixed conflict
Nov 19, 2021
2c358ba
changes
Nov 19, 2021
f829691
g
Nov 19, 2021
f660bd0
fixed merge conflict
Nov 19, 2021
99e298c
h
Nov 19, 2021
c832d3d
Finished testing
Nov 19, 2021
6c70861
Merge branch 'JacobBranch' of https://github.com/TeamTripleJJJ/casino…
Nov 19, 2021
437bfd0
updated
Nov 19, 2021
c0bee9a
fixed wager/deal cards order
Nov 19, 2021
afb7539
fixed player balace issue
Nov 21, 2021
49a6c32
updated test
Nov 21, 2021
ddfc353
msg
Nov 21, 2021
3fe3365
msg
Nov 21, 2021
fbafa1d
Merge branch 'Junior' of https://github.com/TeamTripleJJJ/casino.mave…
Nov 21, 2021
e0d2bde
Merge branch 'JacobBranch' of https://github.com/TeamTripleJJJ/casino…
Nov 21, 2021
cea6ece
Balance added
Nov 21, 2021
bc6a578
Merge branch 'JacobBranch' of https://github.com/TeamTripleJJJ/casino…
Nov 21, 2021
4422605
test jawns pass
Nov 21, 2021
eb9c39f
add more tests
Nov 21, 2021
5953a7e
fixed tests
Nov 21, 2021
7012974
more tests
Nov 21, 2021
0afd752
All testes added
Nov 21, 2021
ae9aba6
Merge branch 'johnBranch' of https://github.com/TeamTripleJJJ/casino.…
Nov 21, 2021
c8d1129
more test
Nov 21, 2021
bdb5f97
added player test
Nov 21, 2021
f4ab26d
Increased test coverage
Nov 21, 2021
1a317b1
Merge branch 'johnBranch' of https://github.com/TeamTripleJJJ/casino.…
Nov 21, 2021
c2c4641
test coverage increased
Nov 21, 2021
40a5ee9
added welcome graphics
Nov 21, 2021
9025149
added ascii art to title
Nov 21, 2021
739596e
added Jacob's Changes
Nov 21, 2021
5bb05d1
Merge branch 'Junior' of https://github.com/TeamTripleJJJ/casino.mave…
Nov 21, 2021
b24374a
added testing for casino account manager
Nov 21, 2021
ba49414
test coverage increased
Nov 21, 2021
b05f893
Merge branch 'Junior' of https://github.com/TeamTripleJJJ/casino.mave…
Nov 21, 2021
a4c484e
Merge branch 'JacobBranch' of https://github.com/TeamTripleJJJ/casino…
Nov 21, 2021
00d50e7
test coverage increased
Nov 21, 2021
00f0b98
Merge branch 'JacobBranch' of https://github.com/TeamTripleJJJ/casino…
Nov 21, 2021
53c33f8
made some minor changes
Nov 21, 2021
0dabd22
increased test coverage
Nov 21, 2021
a04c2df
added more tests to roulettegame test
Nov 21, 2021
9ead5f5
hello
Nov 21, 2021
552a5f7
test coverage finished
Nov 21, 2021
be95a40
Merge branch 'Junior' of https://github.com/TeamTripleJJJ/casino.mave…
Nov 21, 2021
b65137b
fixed issue in war
Nov 21, 2021
debe0ce
msg
Nov 21, 2021
a8885a4
fixed balance not updatating issue
Nov 21, 2021
79aac05
more changes
Nov 21, 2021
46e1aad
msg
Nov 21, 2021
13d77cf
everything works 0655pm
Nov 21, 2021
479dae3
final commit 6:56
Nov 21, 2021
a29c0cf
Merge branch 'johnBranch' of https://github.com/TeamTripleJJJ/casino.…
Nov 21, 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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Casino Simulation
Jacob Branch


* **Objective** - To create an casino simulation
* **Purpose** - To gain familiarity with general object orientation and design principles
Expand Down
34 changes: 22 additions & 12 deletions src/main/java/com/github/zipcodewilmington/Casino.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import com.github.zipcodewilmington.casino.CasinoAccountManager;
import com.github.zipcodewilmington.casino.GameInterface;
import com.github.zipcodewilmington.casino.PlayerInterface;
import com.github.zipcodewilmington.casino.games.numberguess.NumberGuessGame;
import com.github.zipcodewilmington.casino.games.numberguess.NumberGuessPlayer;
import com.github.zipcodewilmington.casino.games.slots.SlotsGame;
import com.github.zipcodewilmington.casino.games.slots.SlotsPlayer;
import com.github.zipcodewilmington.casino.games.cardGames.BlackJack;
import com.github.zipcodewilmington.casino.games.cardGames.BlackJackPlayer;
import com.github.zipcodewilmington.casino.games.cardGames.War;
import com.github.zipcodewilmington.casino.games.cardGames.WarPlayer;
import com.github.zipcodewilmington.casino.games.roulette.RouletteGame;
import com.github.zipcodewilmington.casino.games.roulette.RoulettePlayer;
import com.github.zipcodewilmington.utils.AnsiColor;
import com.github.zipcodewilmington.utils.IOConsole;

Expand All @@ -17,6 +19,7 @@
public class Casino implements Runnable {
private final IOConsole console = new IOConsole(AnsiColor.BLUE);


@Override
public void run() {
String arcadeDashBoardInput;
Expand All @@ -28,13 +31,19 @@ public void run() {
String accountPassword = console.getStringInput("Enter your account password:");
CasinoAccount casinoAccount = casinoAccountManager.getAccount(accountName, accountPassword);
boolean isValidLogin = casinoAccount != null;

if (isValidLogin) {
String gameSelectionInput = getGameSelectionInput().toUpperCase();
if (gameSelectionInput.equals("SLOTS")) {
play(new SlotsGame(), new SlotsPlayer());
} else if (gameSelectionInput.equals("NUMBERGUESS")) {
play(new NumberGuessGame(), new NumberGuessPlayer());
} else {

if (gameSelectionInput.equalsIgnoreCase("WAR")) {
play(new War(casinoAccount), new WarPlayer(casinoAccount));
}
else if (gameSelectionInput.equalsIgnoreCase("BLACKJACK")) {
play(new BlackJack(casinoAccount), new BlackJackPlayer(casinoAccount));
}
else if (gameSelectionInput.equalsIgnoreCase("ROULETTE")) {
play(new RouletteGame(casinoAccount), new RoulettePlayer(casinoAccount));}
else {
// TODO - implement better exception handling
String errorMessage = "[ %s ] is an invalid game selection";
throw new RuntimeException(String.format(errorMessage, gameSelectionInput));
Expand All @@ -48,7 +57,8 @@ public void run() {
console.println("Welcome to the account-creation screen.");
String accountName = console.getStringInput("Enter your account name:");
String accountPassword = console.getStringInput("Enter your account password:");
CasinoAccount newAccount = casinoAccountManager.createAccount(accountName, accountPassword);
Double accountBalance = console.getDoubleInput("Please make initial deposit:");
CasinoAccount newAccount = casinoAccountManager.createAccount(accountName, accountPassword, accountBalance);
casinoAccountManager.registerAccount(newAccount);
}
} while (!"logout".equals(arcadeDashBoardInput));
Expand All @@ -58,15 +68,15 @@ private String getArcadeDashboardInput() {
return console.getStringInput(new StringBuilder()
.append("Welcome to the Arcade Dashboard!")
.append("\nFrom here, you can select any of the following options:")
.append("\n\t[ create-account ], [ select-game ]")
.append("\n\t[ create-account ], [ select-game ] [ logout ]")
.toString());
}

private String getGameSelectionInput() {
return console.getStringInput(new StringBuilder()
.append("Welcome to the Game Selection Dashboard!")
.append("\nFrom here, you can select any of the following options:")
.append("\n\t[ SLOTS ], [ NUMBERGUESS ]")
.append("\n\t[ WAR ], [ BLACKJACK ], [ ROULETTE ]")
.toString());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package com.github.zipcodewilmington;


import com.github.zipcodewilmington.casino.CasinoAccount;
import com.github.zipcodewilmington.casino.games.roulette.RouletteGame;

import java.util.Arrays;

public class MainApplication {
public static void main(String[] args) {
new Casino().run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,49 @@
* The `ArcadeAccount` is used to log into the system to select a `Game` to play.
*/
public class CasinoAccount {


// todo get acct info from casino.java into here


private String username;
private String password;
private Double balance;


public CasinoAccount(String username, String password, Double balance) {
this.username = username;
this.password = password;
this.balance = balance;
}

public String getUsername() {
return username;
}



public String getPassword() {
return password;
}



public Double getBalance() {
return balance;
}

public void setBalance(Double balance) {
this.balance = balance;
}

// public void addBalance(Double amountToAdd) {
// this.balance += amountToAdd;
// }
// public void reduceBalance(Double amountToReduce) {
// this.balance -= amountToReduce;
// }

}


Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
package com.github.zipcodewilmington.casino;

import com.github.zipcodewilmington.utils.IOConsole;

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

/**
* 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 {
IOConsole console = new IOConsole();

private List<CasinoAccount> accountList = new ArrayList<>();
/**
* @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));
for (CasinoAccount account: accountList) {
String username = account.getUsername();
String password = account.getPassword();
if(username.equals(accountName)){
if(password.equals(accountPassword)){
return account;
}
}
}
console.println("Sorry your account doesn't exist");
return null;
}

/**
Expand All @@ -25,11 +44,15 @@ public CasinoAccount getAccount(String accountName, String accountPassword) {
* @param accountPassword password of account to be created
* @return new instance of `ArcadeAccount` with specified `accountName` and `accountPassword`
*/
public CasinoAccount createAccount(String accountName, String accountPassword) {
String currentMethodName = new Object(){}.getClass().getEnclosingMethod().getName();
String currentClassName = getClass().getName();
String errorMessage = "Method with name [ %s ], defined in class with name [ %s ] has not yet been implemented";
throw new RuntimeException(String.format(errorMessage, currentMethodName, currentClassName));
public CasinoAccount createAccount(String accountName, String accountPassword , Double accountBalance) {
// 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 createAcct = new CasinoAccount(accountName, accountPassword, accountBalance);

return createAcct;
}

/**
Expand All @@ -38,9 +61,12 @@ 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));
this.accountList.add(casinoAccount);


}
}
Loading