Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
cf85b69
got simulation running
Jul 11, 2022
bc3dadf
working bet and looping for now. retains amounts when looping
Jul 12, 2022
459f91d
cleaned up a bit
Jul 12, 2022
b09c7c5
changed loop point
Jul 12, 2022
b3236eb
pushing to new repo
Jul 13, 2022
35839ed
adding BlackJack Tests
Jul 13, 2022
8951739
casino class complete. working on slot test and game
Jul 13, 2022
8cfd897
token class created, board display works, position placement in progress
Jul 14, 2022
df2a4f7
Merge pull request #1 from TamyahD/devConnectFour
TamyahD Jul 14, 2022
e73f169
dice class, accountmanager setup
Jul 14, 2022
158b8f5
Merge pull request #2 from mike-348/master
ChrisKent-Github Jul 14, 2022
b44daf1
aces and InputException
Jul 14, 2022
762f673
Merge branch 'master' of https://github.com/ZC-Sands-Casino/Casino in…
Jul 14, 2022
43eadd6
Merge pull request #3 from CodeDEJ/DEJ-Dev
CodeDEJ Jul 14, 2022
d7c125a
Merge branch 'DEJ-Dev' of https://github.com/ZC-Sands-Casino/Casino
Jul 14, 2022
ce7e766
Added Card Class
ChrisKent-Github Jul 14, 2022
9e6a4f9
fixed board display
Jul 14, 2022
ad45eaa
casino class updated with game names
Jul 14, 2022
bf09e46
using map to track whether there are empty/filled spaces for players …
Jul 14, 2022
eb44ee9
created player class, updated slots player and slotsgame
Jul 14, 2022
8dfbc54
Merge pull request #4 from ericarterbridge/master
ericarterbridge Jul 14, 2022
e10a2e9
chuckaluck
Jul 14, 2022
b6d9975
Merge pull request #5 from mike-348/master
mike-348 Jul 14, 2022
7f00cf2
Merge branch 'Eric-Dev-Branch' of https://github.com/ZC-Sands-Casino/…
Jul 14, 2022
c50562b
working on map & empty/filled positions
Jul 15, 2022
a9ce67e
Merge pull request #1 from ZC-Sands-Casino/Eric-Dev-Branch
TamyahD Jul 15, 2022
e5ed76f
Merge branch 'Eric-Dev-Branch' into devConnectFour
Jul 15, 2022
50aef83
winner tracking implemented, position placement has bugs
Jul 15, 2022
a70afaa
position placement semi-fixed, index & winning condition bug
Jul 15, 2022
a71ee37
Merge pull request #6 from TamyahD/devConnectFour
TamyahD Jul 15, 2022
6a02c7d
Added to DeckofCards Class
ChrisKent-Github Jul 15, 2022
aa4e656
more betting options
Jul 15, 2022
7d0f56a
Merge pull request #7 from ChrisKent-Github/master
TamyahD Jul 15, 2022
1e6c9a4
Merge pull request #9 from mike-348/master
mike-348 Jul 15, 2022
62f29cb
Merge pull request #8 from ZC-Sands-Casino/Downes-Dev
ChrisKent-Github Jul 15, 2022
d64cc55
Merge pull request #10 from ZC-Sands-Casino/mike
ChrisKent-Github Jul 15, 2022
8f5343d
doubleDown
Jul 15, 2022
5953512
Merge pull request #11 from CodeDEJ/DEJ-Dev
ChrisKent-Github Jul 15, 2022
a211148
Merge pull request #12 from ZC-Sands-Casino/DEJ-Dev
ChrisKent-Github Jul 15, 2022
9e3ab4e
worked on connect 4 player
Jul 15, 2022
f9d7267
Merge pull request #13 from ericarterbridge/master
ericarterbridge Jul 15, 2022
6e75025
Fixed DeckOfCards and started updating Card class
ChrisKent-Github Jul 15, 2022
01a5335
Merge pull request #14 from ChrisKent-Github/master
ericarterbridge Jul 15, 2022
1b3d122
updated casino class: no longer makes you log in after creating accou…
Jul 15, 2022
9b51068
Merge pull request #15 from ericarterbridge/master
ericarterbridge Jul 15, 2022
eba721a
chuckaluck game and player updates
Jul 15, 2022
532d7cd
Merge pull request #16 from mike-348/master
mike-348 Jul 15, 2022
91c5883
Merge pull request #17 from ZC-Sands-Casino/Eric-Dev-Branch
ChrisKent-Github Jul 15, 2022
6fd48c9
Merge pull request #18 from ZC-Sands-Casino/mike
ericarterbridge Jul 15, 2022
8b6c772
added code to include chuckaluck in game options
Jul 15, 2022
0302a5e
Merge pull request #19 from ericarterbridge/master
mike-348 Jul 15, 2022
4e8e7a2
Updated Card and DeckOfCardsClass: started adding value element to Ca…
ChrisKent-Github Jul 15, 2022
c74303a
Finished Card and DeckofCards Class
ChrisKent-Github Jul 16, 2022
d89b810
Merge pull request #21 from ChrisKent-Github/master
CodeDEJ Jul 16, 2022
3f5b9de
some art
Jul 16, 2022
78da79c
chuck a luck game almost done
Jul 16, 2022
938e23b
Merge branch 'master' of https://github.com/ZC-Sands-Casino/Casino
Jul 16, 2022
6d89489
Merge pull request #22 from mike-348/master
mike-348 Jul 16, 2022
e06fe00
chuckaluck latest
Jul 18, 2022
e1574d1
Merge pull request #26 from mike-348/master
mike-348 Jul 18, 2022
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
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions savedAccounts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
Binary file added src/.DS_Store
Binary file not shown.
Binary file added src/main/.DS_Store
Binary file not shown.
Binary file added src/main/java/.DS_Store
Binary file not shown.
Binary file added src/main/java/com/.DS_Store
Binary file not shown.
Binary file added src/main/java/com/github/.DS_Store
Binary file not shown.
Binary file not shown.
92 changes: 62 additions & 30 deletions src/main/java/com/github/zipcodewilmington/Casino.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
import com.github.zipcodewilmington.casino.CasinoAccountManager;
import com.github.zipcodewilmington.casino.GameInterface;
import com.github.zipcodewilmington.casino.PlayerInterface;
import com.github.zipcodewilmington.casino.games.chuckaluck.ChuckALuckGame;
import com.github.zipcodewilmington.casino.games.chuckaluck.ChuckALuckPlayer;
import com.github.zipcodewilmington.casino.games.connectfour.ConnectFour;
import com.github.zipcodewilmington.casino.games.connectfour.ConnectFourPlayer;
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.utils.AnsiColor;
import com.github.zipcodewilmington.utils.IOConsole;

import java.util.Objects;

/**
* Created by leon on 7/21/2020.
*/
Expand All @@ -21,58 +27,84 @@ public class Casino implements Runnable {
public void run() {
String arcadeDashBoardInput;
CasinoAccountManager casinoAccountManager = new CasinoAccountManager();
try{
do {
arcadeDashBoardInput = getArcadeDashboardInput();
if ("select-game".equals(arcadeDashBoardInput)) {
String accountName = console.getStringInput("Enter your account name:");
String accountPassword = console.getStringInput("Enter your account password:");
CasinoAccount casinoAccount = casinoAccountManager.getAccount(accountName, accountPassword);
boolean isValidLogin = casinoAccount != null;
if (isValidLogin) {
String gameSelectionInput = getGameSelectionInput().toUpperCase();
if (gameSelectionInput.equals("SLOTS")) {
play(new SlotsGame(), new SlotsPlayer());
} else if (gameSelectionInput.equals("NUMBERGUESS")) {
play(new NumberGuessGame(), new NumberGuessPlayer());

if ("2".equals(arcadeDashBoardInput)) { //log-in

String accountName = console.getStringInput("Enter your account name:");
String accountPassword = console.getStringInput("Enter your account password:");
CasinoAccount casinoAccount = casinoAccountManager.getAccount(accountName, accountPassword);
boolean isValidLogin = casinoAccount != null;
if (isValidLogin) {
displayGameMenu();


} else {
// TODO - implement better exception handling
String errorMessage = "[ %s ] is an invalid game selection";
throw new RuntimeException(String.format(errorMessage, gameSelectionInput));
String errorMessage = "No account found with name of [ %s ] and password of [ %s ]";
throw new RuntimeException(String.format(errorMessage, accountName, accountPassword));
}
} else {
// TODO - implement better exception handling
String errorMessage = "No account found with name of [ %s ] and password of [ %s ]";
throw new RuntimeException(String.format(errorMessage, accountPassword, accountName));
}
} else if ("create-account".equals(arcadeDashBoardInput)) {
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);
casinoAccountManager.registerAccount(newAccount);
}
} while (!"logout".equals(arcadeDashBoardInput));



} else if ("1".equals(arcadeDashBoardInput)) { //create-account
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);
casinoAccountManager.registerAccount(newAccount);
displayGameMenu();
}

} while(!"logout".equals(arcadeDashBoardInput));
} catch (RuntimeException e){
System.out.println(e.getMessage());
}
}

private void displayGameMenu(){
String gameSelectionInput = getGameSelectionInput().toUpperCase();
if (gameSelectionInput.equals("1")) { //slots
play(new SlotsGame(), new SlotsPlayer());
// } else if (gameSelectionInput.equals("2")) { //cee-lo
// play(new CeeloGame(), new CeeloPlayer());
} else if (gameSelectionInput.equals("3")) { //chuck a luck
play(new ChuckALuckGame(), new ChuckALuckPlayer());
} else if (gameSelectionInput.equals("4")) { //connect four
play(new ConnectFour(), new ConnectFourPlayer());
// } else if (gameSelectionInput.equals("5")) { //blackjack
// play(new BlackjackGame(), new BlackjackPlayer());
// }else if (gameSelectionInput.equals("6")) { //war
// play(new WarGame(), new WarPlayer());
} else {
// TODO - implement better exception handling
String errorMessage = "[ %s ] is an invalid game selection";
throw new RuntimeException(String.format(errorMessage, gameSelectionInput));
}
}


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[ 1. create-account ], [ 2. log-in ]")
.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[ 1. SLOTS ], [ 2. CEE-LO ], [ 3. CHUCK A LUCK], [ 4. CONNECT 4 ], [ 5. BLACKJACK ], [ 6. WAR ]")
.toString());
}

private void play(Object gameObject, Object playerObject) {
GameInterface game = (GameInterface)gameObject;
PlayerInterface player = (PlayerInterface)playerObject;
GameInterface game = (GameInterface) gameObject;
PlayerInterface player = (PlayerInterface) playerObject;
game.add(player);
game.run();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package com.github.zipcodewilmington.casino.games;public class ArcadeAccount {
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,35 @@
* The `ArcadeAccount` is used to log into the system to select a `Game` to play.
*/
public class CasinoAccount {

String userName;
String password;
Integer accountBalance;

public CasinoAccount(String userName, String password) {
this.userName = userName;
this.password = password;
}

public CasinoAccount(String userName, String password, Integer balance) {
this.userName = userName;
this.password = password;
this.accountBalance = balance;
}
public void updateAccountBalance(Integer amount) {
this.accountBalance += amount;
}

public String getUserName() {
return userName;
}

public String getPassword() {
return password;
}

public Integer getAccountBalance() {
return accountBalance;
}

}
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
package com.github.zipcodewilmington.casino;

import java.util.*;

/**
* Created by leon on 7/21/2020.
* `ArcadeAccountManager` stores, manages, and retrieves `ArcadeAccount` objects
* it is advised that every instruction in this class is logged
*/
public class CasinoAccountManager {

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));

for (CasinoAccount a : accountList) {
if (accountName.equals(a.getUserName()) && accountPassword.equals(a.getPassword())) {
return a;
}
}

// 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));
return null;
}

// if (accountManager.getAccount(param1, parfam2) == null) {sysmt.out.pronta;ksdjhfa;ls}

/**
* logs & creates a new `ArcadeAccount`
*
Expand All @@ -26,10 +40,14 @@ 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));

CasinoAccount newAccount = new CasinoAccount(accountName, accountPassword);
return newAccount;

// 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));
}

/**
Expand All @@ -38,9 +56,11 @@ 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));

this.accountList.add(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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ public interface PlayerInterface {
/**
* @return the `ArcadeAccount` used to log into the `Arcade` system to play this game
*/
CasinoAccount getArcadeAccount();
CasinoAccount getCasinoAccount();

/**
* Defines how a specific implementation of `PlayerInterface` plays their respective game.
* @param <SomeReturnType> specify any return type you would like here
* @return whatever return value you would like
*/
<SomeReturnType> SomeReturnType play();
// <SomeReturnType> SomeReturnType play();
}
Loading