Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 9 additions & 1 deletion src/main/java/io/zipcoder/casino/Casino.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

public class Casino {
public static void main(String[] args) {
// write your tests before you start fucking with this
//Hi welcome to casino.
//what's your name
//how much money do you have

//print out the two games
//what game do you want to play
//create the game
//play the game
//do you want to play again?
}
}
6 changes: 6 additions & 0 deletions src/main/java/io/zipcoder/casino/Game.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.zipcoder.casino;

public interface Game {

void play();
}
70 changes: 70 additions & 0 deletions src/main/java/io/zipcoder/casino/Player.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package io.zipcoder.casino;

public class Player {

//declare a field of type String named name
//declare a field of type double named money

//create a constructor that takes a name
// and set it to the field name

//create a constructor that takes a name
// and money. Set them to their fields

//create a getter and setter for both fields

//create a method called addMoney which
// takes in a double named amount.
// the method will add the amount to the
// money

//create a method called pay which
//takes a double named amount
//the method will substract the amount from
//the money

private String name;
private double money;

public Player (String name) {

this.name = name;
}

public Player (String name, double money) {

this.name = name;
this.money = money;

}

public void setName(String playerone) {

this.name = playerone;

}

public String getName(){

return name;
}

public double getMoney() {
return money;
}
//add a getter for money

public double addMoney(double amount1){
money = money + amount1;
return money;
}

public double pay(double amount2){
money = money - amount2;
return money;

}


}

17 changes: 17 additions & 0 deletions src/main/java/io/zipcoder/casino/blackjack/BlackJackConsole.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.zipcoder.casino.blackjack;

public class BlackJackConsole {
//define a field of type Console named console

//create a method that takes in
// a List<Card>
// the method will display the suite
// and face value of card


//create a method called printResult which
//takes in String param and a double amount
// if the String is "win" say "You won $amount"
// if the string is "lose" say "You lost $amount"
// else say "it's a draw"
}
62 changes: 62 additions & 0 deletions src/main/java/io/zipcoder/casino/blackjack/BlackJackGame.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package io.zipcoder.casino.blackjack;

import io.zipcoder.casino.Player;

// implements Game
public class BlackJackGame {
//declare a field of type Player named dealer
//declare a field of type Player named player
//declare a field of type Deck named deck
//declare a field of type double named playerBet
//declare a field of type BlackJackConsole named console

//create a constructor that takes in a
// CardPlayer, Deck, and BlackJackConsole
// set the fields to the params

// create a constructor that takes in a
// CardPlayer and a BlackJackConsole
// set the fields to the params
// Create a new Deck and set it to the deck field


//create a method named play with no return type or parameter
public void play(){
//deal cards
//show player their cards
// ask them how much they want to bet
// store the result in the playerBet
//call takeTurn(player)
//call takeTurn(dealer)
//check if the player win by calling
//BlackJackRule.getResult and give it
// the player hand and the dealer hand
// if the result return "win"
// then addMoney to the player with
// the playerBet amount
// if result return "lose" then
// ask the player to pay the playerBet amount
// print dealer hand
// print the player hand
// call console.printResult with
// the result and playerBet

}

//create a method named deal with no return type
public void deal(Deck deck, CardPlayer... players){

}

//create a method named takeTurn that takes in
//player and return nothing
// the method will:
//in a while loop
// ask if they want to draw
// if they say no, exit the loop
// else add a card to the player hand
// call BlackJackRule to checks if
// it's busted?
// if it's busted, exit the loop

}
21 changes: 21 additions & 0 deletions src/main/java/io/zipcoder/casino/blackjack/BlackJackRule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package io.zipcoder.casino.blackjack;

public class BlackJackRule {

//create a method called isBusted
//takes in a List<Card> named hand
//checks to see if the hand is busted
//a hand is busted if it's over 21
//ace can be 1 or 11
// 10, Jack, Queen, King are 10

//create a method named getResult
// that takes in two List<Card>
// and return a String
// return "win" if the first hand
// is higher but not busted
// return "lose" if the first hand is
// less than the second hand
// return "draw" if both hands are equal
// or if both hands are busted
}
9 changes: 9 additions & 0 deletions src/main/java/io/zipcoder/casino/blackjack/Card.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.zipcoder.casino.blackjack;

public class Card {
//declare a field of type Suite named suite
//declare a field of type FaceValue named faceValue

//create a getter and setter for both fields

}
40 changes: 40 additions & 0 deletions src/main/java/io/zipcoder/casino/blackjack/CardPlayer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.zipcoder.casino.blackjack;

import io.zipcoder.casino.Player;

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

//extends from the player
public class CardPlayer extends Player {
//create a field of type List<Card> named hand

// create a method named add that takes a
// card and add it to the list cards
// it does not return anything

//create a method named getHand that takes
// in no param and return the player hand


List<Card> hand = new ArrayList<Card>();

public CardPlayer(String name) {
super(name);
}

public CardPlayer(String name, double money) {
super(name, money);
}


public void add(Card card) {
hand.add(card);
}

public List<Card> getHand() {

return hand;

}
}
57 changes: 57 additions & 0 deletions src/main/java/io/zipcoder/casino/blackjack/Deck.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package io.zipcoder.casino.blackjack;

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

public class Deck {
//create a field of type List<Card> named cards
private Stack<Card> deckOfCards;
private int numberOfCards;
private String faceType;
private Card cards[];

//create an empty constructor
//in the body of the constructor initialize
// the list to a new ArrayList<Card>
// call the method generate to generate a deck of card

public Deck() {
List<Card> deckOfCards = new ArrayList<Card>();
}
// create a method named generate that takes in no params
// and return nothing
// this method will generate all 52 cards
public void generate() {

this.cards = new Card[52];
for (int i = 0; i < cards.length ; i++) {

}
}
// create a method named add that takes a
// card and add it to the list cards
// it does not return anything
public void addCardToHand(Card card) {
deckOfCards.add(card);

}
//create a method named draw that takes in
//no param and return a card
//the method will remove a card from the list
// at index 0
public Card draw() {
deckOfCards.remove(0);
deckOfCards.size();

return draw();
}
//create a method called shuffle
//no return, no param
// it will call the method shuffle from
// the Collections class
public void shuffle(){

}
}
7 changes: 7 additions & 0 deletions src/main/java/io/zipcoder/casino/blackjack/FaceValue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.zipcoder.casino.blackjack;

public enum FaceValue {
ACE, TWO, THREE, FOUR, FIVE, SIX,
SEVEN, EIGHT, NINE, TEN, JACK,
QUEEN, KING;
}
5 changes: 5 additions & 0 deletions src/main/java/io/zipcoder/casino/blackjack/Suite.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.zipcoder.casino.blackjack;

public enum Suite {
DIAMONDS, CLUBS, HEART, SPADES;
}
24 changes: 24 additions & 0 deletions src/main/java/io/zipcoder/casino/chuckaluck/ChuckALuckConsole.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.zipcoder.casino.chuckaluck;

public class ChuckALuckConsole {
//define a field of type Console named console


//create a method named getNumber
// that takes in no param and return an int
// it will ask the user for a number
// and return the number the user enter



//create a method named printResult that takes
// List<Integer> and print out
// dice 1 is
// dice 2 is
// dice 3 is





}
45 changes: 45 additions & 0 deletions src/main/java/io/zipcoder/casino/chuckaluck/ChuckALuckGame.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.zipcoder.casino.chuckaluck;

//implements Game
public class ChuckALuckGame {
//create a field of type Player named player
//create a field of type double named playerBet
// create a field of type List<Integer> named userGuesses
// create a field of type List<Integer> named results

//create a constructor that takes in a player
// in the constructor, set the player to the player field
// initialize the userGuesses and results to ArrayList<Integer>




//create a method named play that takes in
// no parameter and does not return anything
// same method signature as the Game interface
//this method will:
// ask player for 3 numbers
// store the player answer in the userGuesses
// roll a dice 3 times
// add the result of the dice to the results list
// call the ChuckALuckConsole to print out the user guesses
// Call the ChuckALuckConsole print out the dice results
// if the matches is 2, then call player to addMoney
// with the playerBet amount
// if the matches is 3, then call player to addMoney
// with twice the amount of the playerBet
// if the match is 0, then call player to pay
// the playerBet amount
// Call ChuckALuckConsole.printResult to print out result



//create a method named getMatches that takes in
// no params and return an int
// the method will count how many number in
// the userGuesses matches the results
// return the count



}
Loading