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
     <groupId>io.zipcoder</groupId>
7
     <groupId>io.zipcoder</groupId>
8
     <artifactId>casino</artifactId>
8
     <artifactId>casino</artifactId>
9
     <version>1.0-SNAPSHOT</version>
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
     <dependencies>
23
     <dependencies>
12
         <dependency>
24
         <dependency>

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

6
     private int value;
6
     private int value;
7
     private String name;
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
 
2
 
3
 import java.util.HashMap;
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
     private int tablePot;
6
     private int tablePot;
8
     private int minBet;
7
     private int minBet;
9
     private int maxBet;
8
     private int maxBet;
17
         this.maxBet = maxBet;
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
     public void Shuffle(){
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
 package io.zipcoder.casino;
1
 package io.zipcoder.casino;
2
 
2
 
3
 import java.util.ArrayList;
3
 import java.util.ArrayList;
4
-import java.util.HashMap;
5
 
4
 
6
 public class CardPlayer {
5
 public class CardPlayer {
7
     private Player player;
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
 public class Console {
3
 public class Console {
4
     private Game[] games;
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
     public void createAccount(){
8
     public void createAccount(){
15
 
9
 
16
     }
10
     }
17
 
11
 
18
     public void chooseGame(String gameName){
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
 import java.util.Collections;
4
 import java.util.Collections;
5
 
5
 
6
 public class Deck {
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
 public class Dice {
3
 public class Dice {
4
     private int sides;
4
     private int sides;
5
     private int value;
5
     private int value;
6
-    private ScoreSheet scoreSheet;
7
 
6
 
8
     public void Roll(){
7
     public void Roll(){
9
 
8
 

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

1
 package io.zipcoder.casino;
1
 package io.zipcoder.casino;
2
 
2
 
3
-public class DiceGame {
3
+public abstract class DiceGame {
4
     private int amoutdice;
4
     private int amoutdice;
5
-    int numberOfRolls;
5
+    private int numberOfRolls;
6
     private Player[] players;
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
 
4
 
5
 public class DicePlayer {
5
 public class DicePlayer {
6
     private Player player;
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
 package io.zipcoder.casino;
1
 package io.zipcoder.casino;
2
 
2
 
3
 public interface Gamble {
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
 package io.zipcoder.casino;
1
 package io.zipcoder.casino;
2
 
2
 
3
 public interface Game {
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
+//Lauren
2
+
1
 package io.zipcoder.casino;
3
 package io.zipcoder.casino;
2
 
4
 
5
+import java.util.HashMap;
6
+import java.util.Map;
7
+
3
 public class ScoreSheet {
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
     public int getScore() {
13
     public int getScore() {
11
-        return score;
14
+        return 0;
12
     }
15
     }
13
 
16
 
14
     public void setScore(int score) {
17
     public void setScore(int score) {
15
-        this.score = score;
18
+
16
     }
19
     }
17
 
20
 
18
     public void printScore(){
21
     public void printScore(){
19
-        System.out.println(score);
22
+
20
     }
23
     }
21
 
24
 
22
     public void setRow(String setRow){
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
         super(minBet, maxBet);
5
         super(minBet, maxBet);
6
     }
6
     }
7
 
7
 
8
+    public void Deal() {
9
+
10
+    }
11
+
8
 
12
 
9
     public void determineWinner(){
13
     public void determineWinner(){
10
 
14
 
33
     /**
37
     /**
34
      * Below 3 Implemented from Game
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
 package io.zipcoder.casino;
1
 package io.zipcoder.casino;
2
 
2
 
3
+import java.util.ArrayList;
3
 import java.util.HashMap;
4
 import java.util.HashMap;
4
 
5
 
5
 public class War extends CardGame implements Gamble, Game {
6
 public class War extends CardGame implements Gamble, Game {
6
 
7
 
8
+    private ArrayList<Card> tableCards = new ArrayList<Card>();
9
+
7
     War(int minBet, int maxBet) {
10
     War(int minBet, int maxBet) {
8
         super(minBet, maxBet);
11
         super(minBet, maxBet);
9
     }
12
     }
10
 
13
 
14
+    public void Deal() {
15
+
16
+    }
17
+
18
+    /**
19
+     * Specific to war methods
20
+     */
11
     public void playCard(){
21
     public void playCard(){
12
 
22
 
13
     }
23
     }
22
 
32
 
23
     /**
33
     /**
24
      * Below 3 Implemented from Gamble
34
      * Below 3 Implemented from Gamble
25
-     * @param betAmount
26
      */
35
      */
27
     public void Bet(int betAmount) {
36
     public void Bet(int betAmount) {
28
 
37
 
39
     /**
48
     /**
40
      * Below 3 Implemented from Game
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
     private Dice[] cup;
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
     public void stopRoll(){
15
     public void stopRoll(){
16
 
16
 
17
     }
17
     }
18
+
18
     /**
19
     /**
19
      * implemented from 'Game'
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