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

Feat/plinko #31

Open
wants to merge 84 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
b7bd1c0
Star squad
Jul 13, 2021
05d5a74
edited GameInterface
Jul 13, 2021
aff72a2
Merge pull request #1 from NicholasWolak/master
NicholasWolak Jul 13, 2021
37cd7b0
completed Dice class and tests
Jul 13, 2021
abb420b
Merge pull request #2 from ZachSinger/master
ZachSinger Jul 13, 2021
9c56a53
Merge pull request #3 from Casino-Royale/master
NicholasWolak Jul 13, 2021
1da0132
Merge branch 'Casino-Royale:master' into master
NicholasWolak Jul 13, 2021
b9631bd
started slots class
Jul 13, 2021
ef99705
started slots class
Jul 13, 2021
b3eee43
Merge pull request #4 from Casino-Royale/Dev
tnguyen1912 Jul 13, 2021
d23c2a2
edited GameInterface
Jul 13, 2021
e14aeb8
started slots class
Jul 13, 2021
d937b7e
started slots class
Jul 13, 2021
f080d9f
Edited GameInterface
Jul 13, 2021
0a35cc9
Merge pull request #5 from tnguyen1912/master
tnguyen1912 Jul 13, 2021
28be7ba
Merge pull request #6 from Casino-Royale/Dev
NicholasWolak Jul 13, 2021
0e6255e
Started BlackJack, needs a lot of reform
Jul 13, 2021
d61b621
please work
Jul 13, 2021
b6997ba
Completed Beetle.java and tests for Beetle.java
Jul 13, 2021
b89d734
Merge pull request #7 from ZachSinger/master
ZachSinger Jul 13, 2021
6ddad3f
Player.java ready
Jul 13, 2021
76d125f
Have to reform cards, updating BlackJack
Jul 13, 2021
5bfc4e9
Merge pull request #9 from NicholasWolak/master
NicholasWolak Jul 13, 2021
f8aa1c3
Merge pull request #10 from Casino-Royale/master
NicholasWolak Jul 13, 2021
ab9b8d3
Merge pull request #8 from Dipinti3/Dev
NicholasWolak Jul 13, 2021
9280d16
Merge branch 'Casino-Royale:master' into master
ZachSinger Jul 13, 2021
879a3a1
Merge pull request #11 from Casino-Royale/Dev
ZachSinger Jul 13, 2021
8917f93
Merge branch 'Casino-Royale:master' into master
ZachSinger Jul 13, 2021
bd973ac
Ready 2 Merge
Jul 13, 2021
52b857a
Take this shit
Jul 13, 2021
4bdcff2
Merge pull request #12 from tnguyen1912/master
tnguyen1912 Jul 13, 2021
13c97cb
Merge pull request #13 from ZachSinger/master
ZachSinger Jul 13, 2021
151543f
SLOTS SLOTS SLOTS
Jul 13, 2021
c920eee
21 21 21
Jul 13, 2021
38df35b
Setting up my branch
Jul 13, 2021
4e0864f
fucking work
Jul 13, 2021
9c74036
what
Jul 13, 2021
8c83e9b
Merge pull request #14 from Casino-Royale/Nick
NicholasWolak Jul 13, 2021
079ecb1
pushin for the cushion
Jul 13, 2021
372acde
plz
Jul 13, 2021
698fc05
Solved some problems
Jul 13, 2021
13561fd
uhh
Jul 13, 2021
96fa77e
testing
Jul 13, 2021
c4d34c3
Edited BeetleGame
Jul 13, 2021
fb947bd
Merge branch 'master' into Dev
Jul 13, 2021
b7067a7
feat(black-jack): update readme for example
Jul 13, 2021
114de0d
Merge pull request #15 from Casino-Royale/feat/black-jack
NicholasWolak Jul 13, 2021
56a1db9
feat/black-jack update
Jul 14, 2021
030dcf7
Merge pull request #17 from Casino-Royale/feat/black-jack
NicholasWolak Jul 14, 2021
dbda690
pulling
Jul 14, 2021
cde49a7
g
Jul 14, 2021
412c509
CasinoAccount and CasinoAccountManager.java (#19)
ZachSinger Jul 14, 2021
36b2994
plinkogame and plinkotest done
Jul 14, 2021
215c282
Feature/casino account (#20)
ZachSinger Jul 14, 2021
a2018af
Feature/casino account (#21)
ZachSinger Jul 14, 2021
71abb54
pulling (#22)
ZachSinger Jul 14, 2021
5c51613
plinko.java is ready
Jul 14, 2021
278a0ca
Feature/casino account (#23)
ZachSinger Jul 14, 2021
248f47f
(feat:black-jack) game logic completed, need refinment and bet input
Jul 14, 2021
6d3d1ac
Merge pull request #25 from Casino-Royale/feat/plinko
Dipinti3 Jul 14, 2021
eb43adc
Feature/slots (#24)
tnguyen1912 Jul 14, 2021
ffc4938
CasinoAccountManager and Casino thru to game selection. Account login…
Jul 14, 2021
6a7d660
attempting to fix issues with merge
Jul 14, 2021
9308a8f
(feat:black-jack) game logic built, continuing on formatting
Jul 14, 2021
321ff08
Feature/casino account (#27)
ZachSinger Jul 14, 2021
041b9d6
Merge branch 'Dev' into feat/black-jack
NicholasWolak Jul 14, 2021
f60d282
Feat/black jack (#26)
NicholasWolak Jul 14, 2021
d7b6482
commiting for merge
Jul 14, 2021
5b2842e
dev merge
Jul 14, 2021
0623f4b
(feat:black-jack) merging
Jul 14, 2021
d63da3d
Merge pull request #28 from Casino-Royale/feat/black-jack
NicholasWolak Jul 14, 2021
a867caf
added new comment in slots
Jul 14, 2021
f3a12d5
Merge pull request #29 from Casino-Royale/feature/slotsGAME
tnguyen1912 Jul 14, 2021
f751781
Changed Double data type to Integer in Player class
Jul 14, 2021
b997b84
Merge pull request #31 from Casino-Royale/feature/player
NicholasWolak Jul 14, 2021
e824278
(feat:black-jack) just to be safe
Jul 14, 2021
2a61307
Merge pull request #32 from Casino-Royale/feat/black-jack
NicholasWolak Jul 14, 2021
4b6447f
Safety check
Jul 14, 2021
9506a0a
Merge pull request #33 from Casino-Royale/feat/black-jack
NicholasWolak Jul 14, 2021
800164e
Updated player interface by removing run method, changed Double Integ…
Jul 14, 2021
2f40239
Feature/beetle game (#34)
ZachSinger Jul 14, 2021
796b2c9
updated plinko.java without override methods
Jul 14, 2021
f79717e
also updated the plinkotest without overrides
Jul 14, 2021
591d902
Merge branch 'Dev' into feat/plinko
NicholasWolak Jul 14, 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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,8 @@
* from the browser, navigate to the _forked_ project from **your** github account.
* click the `Pull Requests` tab.
* select `New Pull Request`




## Adding a line to the readMe for git hub example
2 changes: 1 addition & 1 deletion src/main/java/com/github/zipcodewilmington/Casino.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void run() {
} 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));
//throw new RuntimeException(String.format(errorMessage, accountPassword, accountName));
}
} else if ("create-account".equals(arcadeDashBoardInput)) {
console.println("Welcome to the account-creation screen.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
package com.github.zipcodewilmington.casino;

import com.github.zipcodewilmington.Casino;

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

/**
* Created by leon on 7/21/2020.
* `ArcadeAccount` is registered for each user of the `Arcade`.
* The `ArcadeAccount` is used to log into the system to select a `Game` to play.
*/
public class CasinoAccount {
private String password;
private String accountName;


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


public String getPassword() {
return password;
}

public String getAccountName() {
return accountName;
}

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

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 {
private List<CasinoAccount> accountList = new ArrayList<CasinoAccount>();
/**
* @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) {
for(int i = 0; i < accountList.size(); i++){
CasinoAccount currentAccount = accountList.get(i);
String pass = currentAccount.getPassword();
String name = currentAccount.getAccountName();
if(name.equals(accountName))
if(pass.equals(accountPassword)){
return currentAccount;
} else {
System.out.println("Account Name or Password does not match. Are you really you?");
return null;
}
}
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";
Expand All @@ -26,10 +42,12 @@ 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 myAccount = new CasinoAccount(accountName, accountPassword);
return myAccount;
//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,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));
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
@@ -1,7 +1,8 @@
package com.github.zipcodewilmington.casino;

/**
* Created by leon on 7/21/2020.
* Author: Nathan
* Date: 7/12/21
*/
public interface GameInterface extends Runnable {
/**
Expand All @@ -20,4 +21,21 @@ public interface GameInterface extends Runnable {
* specifies how the game will run
*/
void run();

/**
* Calculate player's winning payout amount of bet x multiplier
* @return (double) amount of money winnings
*/
Integer calculateWinnings(Integer multiplier, Integer betAmount);

/**
* Subtract the bet amount from player's balance
*/
void subtractBetFromBalance(Integer betAmount);

/**
* Add winnings amount to player's balance
*/
void addMoneyToBalance(PlayerInterface Player, Integer winnings);

}
42 changes: 42 additions & 0 deletions src/main/java/com/github/zipcodewilmington/casino/Player.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.github.zipcodewilmington.casino;

public class Player{

String name;
Integer balance;
Integer currentBet = 0;

public Player(String name, Integer initialDeposit) {
this.name = name;
this.balance = initialDeposit;
}


public String getName() {
return name;
}


public Integer getBalance() {
return balance;
}

private void setCurrentBet(Integer currentBet) {
this.currentBet = currentBet;
}

public void setBalance(Integer deposit) {
this.balance = balance + deposit;
}


public Integer makeBet(Integer betAmount) {
currentBet = betAmount;
balance = balance - currentBet;
return currentBet;
}

private Integer getCurrentBet() {
return currentBet;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ public interface PlayerInterface {
* @param <SomeReturnType> specify any return type you would like here
* @return whatever return value you would like
*/
<SomeReturnType> SomeReturnType play();
//<SomeReturnType> SomeReturnType play();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package com.github.zipcodewilmington.casino.games.Beetle;

import com.github.zipcodewilmington.casino.models.Dice;

public class Beetle{
private Dice dice = new Dice(1);
private Integer currentPlayer = 0;
private Integer[][] playerBeetles;
private Integer[] scoreboard;
private Integer numPlayers;

public Beetle(Integer numPlayers){
this.numPlayers = numPlayers;
this.playerBeetles = new Integer[numPlayers][6];
this.scoreboard = new Integer[numPlayers];
this.initializeBeetleCards();
this.initializeScoreboards();
}

public void initializeBeetleCards(){
for(int i = 0; i < numPlayers; i++){
for(int j = 0; j < 6; j++){
this.playerBeetles[i][j] = 0;
}
}
}

public void initializeScoreboards(){
for(int i = 0; i < numPlayers; i++){
this.scoreboard[i] = 0;
}
}

public Dice getDice() {
return dice;
}

public Integer getCurrentPlayer() {
return currentPlayer;
}

public Integer[][] getPlayerBeetles() {
return playerBeetles;
}

public Integer getNumPlayers() {
return numPlayers;
}

public Integer[] getPlayerCard(Integer playerNumber){
return this.getPlayerBeetles()[playerNumber];
}

public void setCurrentPlayer(Integer currentPlayer) {
this.currentPlayer = currentPlayer;
}

public void setPlayerBeetles(Integer player, Integer diceRoll) {
this.playerBeetles[player][diceRoll]++;
//return this.checkWinner(player);
}

public void nextPlayer(){
this.currentPlayer = (this.currentPlayer + 1) % this.numPlayers;
}

public void refreshBeetle(Integer player){
this.playerBeetles[player] = new Integer[] {0, 0, 0, 0, 0, 0};
}


public Boolean checkWinner(Integer player){
if(this.beetleIsComplete(player)){
this.scoreboard[player] += 6;
if(this.getScore(player) == 30){
return true;
} else {
this.refreshBeetle(player);
}
}
return false;
}

public Boolean beetleIsComplete(Integer player){
Integer[] playerBeetle = getPlayerCard(player);
for(int i = 0; i < 6; i++){
if(playerBeetle[i] == 0)
return false;
}
return true;
}

public Integer getScore(Integer player){
return this.scoreboard[player];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package com.github.zipcodewilmington.casino.games.Beetle;

import com.github.zipcodewilmington.casino.GameInterface;
import com.github.zipcodewilmington.casino.PlayerInterface;

import java.util.ArrayList;

public class BeetleGame implements GameInterface {
private ArrayList<PlayerInterface> players = new ArrayList<PlayerInterface>();
private Beetle game;
private Boolean isRunning = false;
private PlayerInterface player;
public void add(PlayerInterface player){
players.add(player);
}

/**
* removes a player from the game
* @param player the player to be removed from the game
*/
public void remove(PlayerInterface player){
players.remove(player);
}

/**
* specifies how the game will run
*/
public void run(){
Integer turnCount = 0;
if(isRunning){
turnCount++;
this.nextPlayer();
game.getDice().tossAndSum();
executeTurn();
isGameOver(game.checkWinner(game.getCurrentPlayer()));
}
System.out.println("game over after " + turnCount);
}

public void isGameOver(boolean playerWon){
if(playerWon){
isRunning = false;
}
}
public void nextPlayer(){
game.setCurrentPlayer(-1);
game.nextPlayer();
}

public void executeTurn(){
Integer currentPlayer = game.getCurrentPlayer();
game.setPlayerBeetles(currentPlayer, game.getDice().tossAndSum());
}

/**
* Calculate player's winning payout amount of bet x multiplier
* @return (double) amount of money winnings
*/
public Integer calculateWinnings(Integer multiplier, Integer betAmount){
return 0;
}

/**
* Subtract the bet amount from player's balance
*/
public void subtractBetFromBalance(Integer betAmount){

}


/**
* Add winnings amount to player's balance
*/
public void addMoneyToBalance(PlayerInterface Player, Integer winnings){

}

public void initGame(Integer players){
this.game = new Beetle(this.players.size());
this.isRunning = true;
this.run();
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.github.zipcodewilmington.casino.games.Beetle;

public class BeetlePlayer {
private Integer bet;

public BeetlePlayer(){

}
}
Loading