Browse Source

Merge branch 'master' of nsatinover/ZCW-OOP-Casino into master

jonathan-hinds 6 years ago
parent
commit
5f94248df5

+ 12
- 0
pom.xml View File

@@ -7,6 +7,18 @@
7 7
     <groupId>io.zipcoder</groupId>
8 8
     <artifactId>casino</artifactId>
9 9
     <version>1.0-SNAPSHOT</version>
10
+    <build>
11
+        <plugins>
12
+            <plugin>
13
+                <groupId>org.apache.maven.plugins</groupId>
14
+                <artifactId>maven-compiler-plugin</artifactId>
15
+                <configuration>
16
+                    <source>7</source>
17
+                    <target>7</target>
18
+                </configuration>
19
+            </plugin>
20
+        </plugins>
21
+    </build>
10 22
 
11 23
     <dependencies>
12 24
         <dependency>

+ 3
- 1
src/main/java/io/zipcoder/casino/Card.java View File

@@ -6,6 +6,8 @@ public class Card {
6 6
     private int value;
7 7
     private String name;
8 8
 
9
-
9
+    public void setVisibility(boolean visibility){
10
+        isVisible = visibility;
11
+    }
10 12
 
11 13
 }

+ 10
- 5
src/main/java/io/zipcoder/casino/CardGame.java View File

@@ -2,8 +2,7 @@ package io.zipcoder.casino;
2 2
 
3 3
 import java.util.HashMap;
4 4
 
5
-public class CardGame {
6
-    private boolean isFaceUp; // Deal() will change IF card is visible
5
+public abstract class CardGame {
7 6
     private int tablePot;
8 7
     private int minBet;
9 8
     private int maxBet;
@@ -17,12 +16,18 @@ public class CardGame {
17 16
         this.maxBet = maxBet;
18 17
     }
19 18
 
20
-    public void Deal(){
21
-        //faceUp/ faceDown
22
-    }
19
+    //use hand size to determine dealing
20
+    public abstract void Deal();
23 21
 
24 22
     public void Shuffle(){
25 23
 
26 24
     }
27 25
 
26
+    public void faceDown(Card card){
27
+        card.setVisibility(false);
28
+    }
29
+
30
+    public void faceUp(Card card){
31
+        card.setVisibility(true);
32
+    }
28 33
 }

+ 2
- 6
src/main/java/io/zipcoder/casino/CardPlayer.java View File

@@ -1,13 +1,9 @@
1 1
 package io.zipcoder.casino;
2 2
 
3 3
 import java.util.ArrayList;
4
-import java.util.HashMap;
5 4
 
6 5
 public class CardPlayer {
7 6
     private Player player;
8
-    /*
9
-    private HashMap<Player, Card[]> hand = new HashMap<Player, Card[]>();
10
-    private ArrayList<Card> cardhand = new ArrayList<Card>();
11
-    private ArrayList<Card> discard = new ArrayList<Card>()
12
-    */
7
+    private ArrayList<Card> hand = new ArrayList<>();
8
+    private ArrayList<Card> discard = new ArrayList<>();
13 9
 }

+ 7
- 8
src/main/java/io/zipcoder/casino/Console.java View File

@@ -3,19 +3,18 @@ package io.zipcoder.casino;
3 3
 public class Console {
4 4
     private Game[] games;
5 5
 
6
-    Console(){
7
-        Yahtzee yahtzee = new Yahtzee();
8
-        Stud stud = new Stud;
9
-        War war = new War;
10
-        games = new Game[yahtzee, stud, war];
11
-    }
12
-
6
+    Console(){}
13 7
 
14 8
     public void createAccount(){
15 9
 
16 10
     }
17 11
 
18 12
     public void chooseGame(String gameName){
19
-
13
+        /*
14
+            ask the user for min max bet at the table
15
+            ask the user which game they would like to play
16
+            create a new game with min and max set based
17
+            on user input
18
+         */
20 19
     }
21 20
 }

+ 1
- 1
src/main/java/io/zipcoder/casino/Deck.java View File

@@ -4,5 +4,5 @@ import java.util.ArrayList;
4 4
 import java.util.Collections;
5 5
 
6 6
 public class Deck {
7
-    ArrayList<Card> deck = new ArrayList<Card>();
7
+    ArrayList<Card> cards = new ArrayList<Card>();
8 8
 }

+ 0
- 1
src/main/java/io/zipcoder/casino/Dice.java View File

@@ -3,7 +3,6 @@ package io.zipcoder.casino;
3 3
 public class Dice {
4 4
     private int sides;
5 5
     private int value;
6
-    private ScoreSheet scoreSheet;
7 6
 
8 7
     public void Roll(){
9 8
 

+ 3
- 3
src/main/java/io/zipcoder/casino/DiceGame.java View File

@@ -1,8 +1,8 @@
1 1
 package io.zipcoder.casino;
2 2
 
3
-public class DiceGame {
3
+public abstract class DiceGame {
4 4
     private int amoutdice;
5
-    int numberOfRolls;
5
+    private int numberOfRolls;
6 6
     private Player[] players;
7
-    private Player playersTrun;
7
+    private Player playersTurn;
8 8
 }

+ 2
- 1
src/main/java/io/zipcoder/casino/DicePlayer.java View File

@@ -4,5 +4,6 @@ import java.util.HashMap;
4 4
 
5 5
 public class DicePlayer {
6 6
     private Player player;
7
-    HashMap<Player, Dice[]> tableDice = new HashMap<Player, Dice[]>();
7
+    Dice[] cup = new Dice[5];
8
+    ScoreSheet scoreSheet = new ScoreSheet();
8 9
 }

+ 3
- 3
src/main/java/io/zipcoder/casino/Gamble.java View File

@@ -1,7 +1,7 @@
1 1
 package io.zipcoder.casino;
2 2
 
3 3
 public interface Gamble {
4
-    public void Bet(int betAmount);
5
-    public int Payout(int payoutAmount);
6
-    public void Ante(int anteAmount);
4
+     void Bet(int betAmount);
5
+     int Payout(int payoutAmount);
6
+     void Ante(int anteAmount);
7 7
 }

+ 3
- 3
src/main/java/io/zipcoder/casino/Game.java View File

@@ -1,7 +1,7 @@
1 1
 package io.zipcoder.casino;
2 2
 
3 3
 public interface Game {
4
-    public void Play();
5
-    public void Quit();
6
-    public void StartRound();
4
+     void Quit();
5
+     void StartGame();
6
+     void StartRound();
7 7
 }

+ 14
- 7
src/main/java/io/zipcoder/casino/ScoreSheet.java View File

@@ -1,25 +1,32 @@
1
+//Lauren
2
+
1 3
 package io.zipcoder.casino;
2 4
 
5
+import java.util.HashMap;
6
+import java.util.Map;
7
+
3 8
 public class ScoreSheet {
4
-    private int score;
9
+    private Map<String, Integer> scores = new HashMap<>();
5 10
 
6
-    ScoreSheet(){
7
-        this.score = 0;
8
-    }
11
+    ScoreSheet(){}
9 12
 
10 13
     public int getScore() {
11
-        return score;
14
+        return 0;
12 15
     }
13 16
 
14 17
     public void setScore(int score) {
15
-        this.score = score;
18
+
16 19
     }
17 20
 
18 21
     public void printScore(){
19
-        System.out.println(score);
22
+
20 23
     }
21 24
 
22 25
     public void setRow(String setRow){
23 26
 
24 27
     }
28
+
29
+    public void calculateScore(String row, int value){
30
+
31
+    }
25 32
 }

+ 7
- 2
src/main/java/io/zipcoder/casino/Stud.java View File

@@ -5,6 +5,10 @@ public class Stud extends CardGame implements Gamble, Game {
5 5
         super(minBet, maxBet);
6 6
     }
7 7
 
8
+    public void Deal() {
9
+
10
+    }
11
+
8 12
 
9 13
     public void determineWinner(){
10 14
 
@@ -33,11 +37,12 @@ public class Stud extends CardGame implements Gamble, Game {
33 37
     /**
34 38
      * Below 3 Implemented from Game
35 39
      */
36
-    public void Play() {
40
+
41
+    public void Quit() {
37 42
 
38 43
     }
39 44
 
40
-    public void Quit() {
45
+    public void StartGame() {
41 46
 
42 47
     }
43 48
 

+ 13
- 3
src/main/java/io/zipcoder/casino/War.java View File

@@ -1,13 +1,23 @@
1 1
 package io.zipcoder.casino;
2 2
 
3
+import java.util.ArrayList;
3 4
 import java.util.HashMap;
4 5
 
5 6
 public class War extends CardGame implements Gamble, Game {
6 7
 
8
+    private ArrayList<Card> tableCards = new ArrayList<Card>();
9
+
7 10
     War(int minBet, int maxBet) {
8 11
         super(minBet, maxBet);
9 12
     }
10 13
 
14
+    public void Deal() {
15
+
16
+    }
17
+
18
+    /**
19
+     * Specific to war methods
20
+     */
11 21
     public void playCard(){
12 22
 
13 23
     }
@@ -22,7 +32,6 @@ public class War extends CardGame implements Gamble, Game {
22 32
 
23 33
     /**
24 34
      * Below 3 Implemented from Gamble
25
-     * @param betAmount
26 35
      */
27 36
     public void Bet(int betAmount) {
28 37
 
@@ -39,11 +48,12 @@ public class War extends CardGame implements Gamble, Game {
39 48
     /**
40 49
      * Below 3 Implemented from Game
41 50
      */
42
-    public void Play() {
51
+
52
+    public void Quit() {
43 53
 
44 54
     }
45 55
 
46
-    public void Quit() {
56
+    public void StartGame() {
47 57
 
48 58
     }
49 59
 

+ 4
- 3
src/main/java/io/zipcoder/casino/Yahtzee.java View File

@@ -4,7 +4,7 @@ public class Yahtzee extends DiceGame implements Game{
4 4
     private Dice[] cup;
5 5
 
6 6
 
7
-    public void compareScore(Player player1, Player player2){
7
+    public void compareScore(DicePlayer player1, DicePlayer player2){
8 8
 
9 9
     }
10 10
 
@@ -15,14 +15,15 @@ public class Yahtzee extends DiceGame implements Game{
15 15
     public void stopRoll(){
16 16
 
17 17
     }
18
+
18 19
     /**
19 20
      * implemented from 'Game'
20 21
      */
21
-    public void Play() {
22
+    public void Quit() {
22 23
 
23 24
     }
24 25
 
25
-    public void Quit() {
26
+    public void StartGame() {
26 27
 
27 28
     }
28 29