Pārlūkot izejas kodu

Merge branch 'working' of https://git.zipcode.rocks/jonathan-hinds/ZCW-OOP-Casino

Lauren Green 6 gadus atpakaļ
vecāks
revīzija
c2f3b768d4

+ 6
- 0
src/.idea/misc.xml Parādīt failu

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="JavaScriptSettings">
4
+    <option name="languageLevel" value="ES6" />
5
+  </component>
6
+</project>

+ 8
- 0
src/.idea/modules.xml Parādīt failu

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/.idea/src.iml" filepath="$PROJECT_DIR$/.idea/src.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 6
- 0
src/.idea/vcs.xml Parādīt failu

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
+  </component>
6
+</project>

+ 236
- 0
src/.idea/workspace.xml Parādīt failu

@@ -0,0 +1,236 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="74cab72c-e027-4e61-ac26-2617cf8ce683" name="Default Changelist" comment="">
5
+      <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
6
+      <change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
7
+      <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
8
+      <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
9
+      <change afterPath="$PROJECT_DIR$/test/java/io/zipcoder/casino/SlotTest.java" afterDir="false" />
10
+      <change beforePath="$PROJECT_DIR$/main/java/io/zipcoder/casino/Casino.java" beforeDir="false" afterPath="$PROJECT_DIR$/main/java/io/zipcoder/casino/Casino.java" afterDir="false" />
11
+      <change beforePath="$PROJECT_DIR$/main/java/io/zipcoder/casino/Game.java" beforeDir="false" afterPath="$PROJECT_DIR$/main/java/io/zipcoder/casino/Game.java" afterDir="false" />
12
+      <change beforePath="$PROJECT_DIR$/main/java/io/zipcoder/casino/Printer.java" beforeDir="false" afterPath="$PROJECT_DIR$/main/java/io/zipcoder/casino/Printer.java" afterDir="false" />
13
+      <change beforePath="$PROJECT_DIR$/main/java/io/zipcoder/casino/SlotMachine.java" beforeDir="false" afterPath="$PROJECT_DIR$/main/java/io/zipcoder/casino/SlotMachine.java" afterDir="false" />
14
+      <change beforePath="$PROJECT_DIR$/main/java/io/zipcoder/casino/Yahtzee.java" beforeDir="false" afterPath="$PROJECT_DIR$/main/java/io/zipcoder/casino/Yahtzee.java" afterDir="false" />
15
+      <change beforePath="$PROJECT_DIR$/test/java/io/zipcoder/casino/CardTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/test/java/io/zipcoder/casino/CardTest.java" afterDir="false" />
16
+    </list>
17
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
18
+    <option name="SHOW_DIALOG" value="false" />
19
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
20
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
21
+    <option name="LAST_RESOLUTION" value="IGNORE" />
22
+  </component>
23
+  <component name="FUSProjectUsageTrigger">
24
+    <session id="729355978">
25
+      <usages-collector id="statistics.lifecycle.project">
26
+        <counts>
27
+          <entry key="project.closed" value="1" />
28
+          <entry key="project.open.time.1" value="1" />
29
+          <entry key="project.opened" value="1" />
30
+        </counts>
31
+      </usages-collector>
32
+      <usages-collector id="statistics.file.extensions.open">
33
+        <counts>
34
+          <entry key="java" value="1" />
35
+        </counts>
36
+      </usages-collector>
37
+      <usages-collector id="statistics.file.types.open">
38
+        <counts>
39
+          <entry key="JAVA" value="1" />
40
+        </counts>
41
+      </usages-collector>
42
+    </session>
43
+  </component>
44
+  <component name="FileEditorManager">
45
+    <leaf>
46
+      <file pinned="false" current-in-tab="true">
47
+        <entry file="file://$PROJECT_DIR$/test/java/io/zipcoder/casino/CardTest.java">
48
+          <provider selected="true" editor-type-id="text-editor">
49
+            <state relative-caret-position="60">
50
+              <caret line="4" column="30" lean-forward="true" selection-start-line="4" selection-start-column="30" selection-end-line="4" selection-end-column="30" />
51
+              <folding>
52
+                <element signature="imports" expanded="true" />
53
+              </folding>
54
+            </state>
55
+          </provider>
56
+        </entry>
57
+      </file>
58
+    </leaf>
59
+  </component>
60
+  <component name="Git.Settings">
61
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
62
+  </component>
63
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
64
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
65
+  <component name="JsGulpfileManager">
66
+    <detection-done>true</detection-done>
67
+    <sorting>DEFINITION_ORDER</sorting>
68
+  </component>
69
+  <component name="ProjectFrameBounds" extendedState="6" fullScreen="true">
70
+    <option name="y" value="23" />
71
+    <option name="width" value="1440" />
72
+    <option name="height" value="817" />
73
+  </component>
74
+  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
75
+  <component name="ProjectView">
76
+    <navigator proportions="" version="1">
77
+      <foldersAlwaysOnTop value="true" />
78
+    </navigator>
79
+    <panes>
80
+      <pane id="ProjectPane">
81
+        <subPane>
82
+          <expand>
83
+            <path>
84
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
85
+              <item name="src" type="462c0819:PsiDirectoryNode" />
86
+            </path>
87
+            <path>
88
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
89
+              <item name="src" type="462c0819:PsiDirectoryNode" />
90
+              <item name="main" type="462c0819:PsiDirectoryNode" />
91
+            </path>
92
+            <path>
93
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
94
+              <item name="src" type="462c0819:PsiDirectoryNode" />
95
+              <item name="main" type="462c0819:PsiDirectoryNode" />
96
+              <item name="java" type="462c0819:PsiDirectoryNode" />
97
+            </path>
98
+            <path>
99
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
100
+              <item name="src" type="462c0819:PsiDirectoryNode" />
101
+              <item name="main" type="462c0819:PsiDirectoryNode" />
102
+              <item name="java" type="462c0819:PsiDirectoryNode" />
103
+              <item name="casino" type="462c0819:PsiDirectoryNode" />
104
+            </path>
105
+            <path>
106
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
107
+              <item name="src" type="462c0819:PsiDirectoryNode" />
108
+              <item name="test" type="462c0819:PsiDirectoryNode" />
109
+            </path>
110
+            <path>
111
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
112
+              <item name="src" type="462c0819:PsiDirectoryNode" />
113
+              <item name="test" type="462c0819:PsiDirectoryNode" />
114
+              <item name="java" type="462c0819:PsiDirectoryNode" />
115
+            </path>
116
+            <path>
117
+              <item name="src" type="b2602c69:ProjectViewProjectNode" />
118
+              <item name="src" type="462c0819:PsiDirectoryNode" />
119
+              <item name="test" type="462c0819:PsiDirectoryNode" />
120
+              <item name="java" type="462c0819:PsiDirectoryNode" />
121
+              <item name="casino" type="462c0819:PsiDirectoryNode" />
122
+            </path>
123
+          </expand>
124
+          <select />
125
+        </subPane>
126
+      </pane>
127
+      <pane id="PackagesPane" />
128
+      <pane id="Scope" />
129
+    </panes>
130
+  </component>
131
+  <component name="PropertiesComponent">
132
+    <property name="WebServerToolWindowFactoryState" value="false" />
133
+    <property name="aspect.path.notification.shown" value="true" />
134
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1541771782363" />
135
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
136
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
137
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
138
+    <property name="settings.editor.selected.configurable" value="preferences.general" />
139
+  </component>
140
+  <component name="RunDashboard">
141
+    <option name="ruleStates">
142
+      <list>
143
+        <RuleState>
144
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
145
+        </RuleState>
146
+        <RuleState>
147
+          <option name="name" value="StatusDashboardGroupingRule" />
148
+        </RuleState>
149
+      </list>
150
+    </option>
151
+  </component>
152
+  <component name="SvnConfiguration">
153
+    <configuration />
154
+  </component>
155
+  <component name="TaskManager">
156
+    <task active="true" id="Default" summary="Default task">
157
+      <changelist id="74cab72c-e027-4e61-ac26-2617cf8ce683" name="Default Changelist" comment="" />
158
+      <created>1541771578720</created>
159
+      <option name="number" value="Default" />
160
+      <option name="presentableId" value="Default" />
161
+      <updated>1541771578720</updated>
162
+      <workItem from="1541771580200" duration="204000" />
163
+    </task>
164
+    <servers />
165
+  </component>
166
+  <component name="TimeTrackingManager">
167
+    <option name="totallyTimeSpent" value="204000" />
168
+  </component>
169
+  <component name="ToolWindowManager">
170
+    <frame x="0" y="0" width="1440" height="900" extended-state="6" />
171
+    <editor active="true" />
172
+    <layout>
173
+      <window_info id="Image Layers" />
174
+      <window_info id="Designer" />
175
+      <window_info id="UI Designer" />
176
+      <window_info id="Capture Tool" />
177
+      <window_info id="Favorites" side_tool="true" />
178
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24964234" />
179
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
180
+      <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
181
+      <window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
182
+      <window_info anchor="bottom" id="Terminal" />
183
+      <window_info anchor="bottom" id="Event Log" side_tool="true" />
184
+      <window_info anchor="bottom" id="Message" order="0" />
185
+      <window_info anchor="bottom" id="Find" order="1" />
186
+      <window_info anchor="bottom" id="Run" order="2" />
187
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
188
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
189
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
190
+      <window_info anchor="bottom" id="TODO" order="6" />
191
+      <window_info anchor="right" id="Palette" />
192
+      <window_info anchor="right" id="Theme Preview" />
193
+      <window_info anchor="right" id="Capture Analysis" />
194
+      <window_info anchor="right" id="Palette&#9;" />
195
+      <window_info anchor="right" id="Database" />
196
+      <window_info anchor="right" id="Maven Projects" />
197
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
198
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
199
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
200
+    </layout>
201
+  </component>
202
+  <component name="TypeScriptGeneratedFilesManager">
203
+    <option name="version" value="1" />
204
+  </component>
205
+  <component name="VcsContentAnnotationSettings">
206
+    <option name="myLimit" value="2678400000" />
207
+  </component>
208
+  <component name="editorHistoryManager">
209
+    <entry file="file://$PROJECT_DIR$/test/java/io/zipcoder/casino/CardTest.java">
210
+      <provider selected="true" editor-type-id="text-editor">
211
+        <state relative-caret-position="60">
212
+          <caret line="4" column="30" lean-forward="true" selection-start-line="4" selection-start-column="30" selection-end-line="4" selection-end-column="30" />
213
+          <folding>
214
+            <element signature="imports" expanded="true" />
215
+          </folding>
216
+        </state>
217
+      </provider>
218
+    </entry>
219
+  </component>
220
+  <component name="masterDetails">
221
+    <states>
222
+      <state key="ProjectJDKs.UI">
223
+        <settings>
224
+          <last-edited>1.8</last-edited>
225
+          <splitter-proportions>
226
+            <option name="proportions">
227
+              <list>
228
+                <option value="0.2" />
229
+              </list>
230
+            </option>
231
+          </splitter-proportions>
232
+        </settings>
233
+      </state>
234
+    </states>
235
+  </component>
236
+</project>

+ 2
- 1
src/main/java/io/zipcoder/casino/CardGame.java Parādīt failu

@@ -24,7 +24,8 @@ public abstract class CardGame {
24 24
     }
25 25
 
26 26
     //use hand size to determine dealing
27
-    public abstract void deal();
27
+    // public abstract void deal();
28
+    // public abstract void deal(ArrayList<CardPlayer> players); // NEEDED FOR STUD
28 29
 
29 30
     public void shuffle(){
30 31
 

+ 11
- 2
src/main/java/io/zipcoder/casino/Casino.java Parādīt failu

@@ -67,19 +67,25 @@ public class Casino {
67 67
 
68 68
                 case 4:
69 69
                     int slotBet1= console.getIntFromUser("Enter the amount you want to bet on Slot");
70
+                    if ((slotBet1 < 0) || (slotBet1 >100) )
71
+                    {
72
+                        Printer.printMessage("Invalid bet amount entered, min bet for slot is $1 and max $100 ");
73
+                        break;
74
+                    }
70 75
                     Game slot= new SlotMachine(slotBet1);
71
-                    slot.startGame();
72 76
                     game = slot;
77
+                    slot.startGame();
78
+                    ((SlotMachine) slot).slotResult();
73 79
                     ((SlotMachine) slot).payout();
74 80
                     break;
75 81
 
76 82
                 case 1:
77 83
                     Game yahtzee = new Yahtzee(player);
84
+                    game = yahtzee;
78 85
                     ((Yahtzee) yahtzee).startGame();
79 86
                     int betAmount = console.getIntFromUser("How much would you like to bet on this game?");
80 87
                     ((Yahtzee) yahtzee).setBid(betAmount);
81 88
                     ((Yahtzee) yahtzee).bet(betAmount);
82
-                    game = yahtzee;
83 89
                     yahtzee.startRound();
84 90
                     Printer.printMessage("You scored " + ((Yahtzee) yahtzee).getDicePlayer().getScoreSheet().getTotalScore() + " points.");
85 91
                     ((Yahtzee) yahtzee).payout();
@@ -132,4 +138,7 @@ public class Casino {
132 138
     public Game getGame() {
133 139
         return game;
134 140
     }
141
+    public boolean isRunning() {
142
+        return running;
143
+    }
135 144
 }

+ 70
- 74
src/main/java/io/zipcoder/casino/SlotMachine.java Parādīt failu

@@ -1,13 +1,17 @@
1 1
 package io.zipcoder.casino;
2 2
 
3 3
 import java.util.Random;
4
-import java.util.Scanner;
5
-
6
-import static java.lang.Thread.sleep;
7 4
 
8 5
 public class SlotMachine implements Game, Gamble {
9 6
     private int betAmount;
10
-    private int payout=0;
7
+    private int payoutAmt=0;
8
+    String word="";
9
+    String outputword="";
10
+
11
+    String word1="";
12
+    String word2="";
13
+    String word3="";
14
+    double totalBet=0;
11 15
 
12 16
     public SlotMachine(int betAmount) {
13 17
         this.betAmount = betAmount;
@@ -16,12 +20,10 @@ public class SlotMachine implements Game, Gamble {
16 20
     @Override
17 21
     public void bet(int betAmount) {
18 22
         this.betAmount= betAmount;
19
-
20 23
     }
21 24
 
22
-    @Override
23 25
     public void payout(){
24
-        Printer.printMessage("Your payout amount for slot machine is: $" + payout + "\n");
26
+        Printer.printMessage("Your payout amount for slot machine is: $" + payoutAmt + "\n");
25 27
     }
26 28
 
27 29
     @Override
@@ -32,7 +34,7 @@ public class SlotMachine implements Game, Gamble {
32 34
         } catch (InterruptedException e) {
33 35
             e.printStackTrace();
34 36
         }
35
-        Printer.printMessage("Your slot is in progress"+"\n");
37
+        Printer.printMessage("Your slot is in progress" + "\n");
36 38
 
37 39
         try {
38 40
             Thread.sleep(3000);
@@ -40,85 +42,65 @@ public class SlotMachine implements Game, Gamble {
40 42
             e.printStackTrace();
41 43
         }
42 44
 
43
-        String word="";
44
-        String outputword="";
45
-        String word1="";
46
-        String word2="";
47
-        String word3="";
48
-        //int useramount=0;
49
-        char playAgain= 'y';
50
-        double totalBet=0;
51
-
52
-       // while(playAgain=='y'){
53
-
54
-            outputword="";
55
-
56
-            Random rand = new Random();
57
-
58
-            for(int i = 1; i <=3;i++){
59
-                int randnum = rand.nextInt(6);
60
-                //System.out.println(randnum);
61
-
62
-                if(randnum == 0) {
63
-                    word = "DOG";
64
-                  //  System.out.println("dog");
65
-                }
66
-                else if(randnum == 1) {
67
-                    word = "CAT";
68
-                  //  System.out.println("cat");
69
-                }
70
-                else if(randnum == 2) {
71
-                    word = "RABBIT";
72
-                  //  System.out.println("kjsd");
73
-                }
74
-                else if(randnum == 3) {
75
-                    word = "SQUIRREL";
76
-                  //  System.out.println("sq");
77
-                }
78
-                else if(randnum == 4) {
79
-                    word = "FISH";
80
-                  //  System.out.println("ff");
81
-                }
82
-                else if(randnum == 5) {
83
-                    word = "MOUSE";
84
-                  //  System.out.println("mm");
85
-                }
86
-                // outputword += word;
87
-
88
-                if(i == 1){
89
-                    word1= word;
90
-                //    System.out.println(i);
91
-                }
92
-
93
-                else if(i == 2){
94
-                    word2= word;
95
-                  //  System.out.println(i);
96
-                }
97
-
98
-                else if(i == 3){
99
-                    word3= word;
100
-                   // System.out.println(word3);
101
-                }
45
+
46
+        outputword = "";
47
+
48
+        Random rand = new Random();
49
+
50
+        for (int i = 1; i <= 3; i++) {
51
+            int randnum = rand.nextInt(6);
52
+
53
+
54
+            if (randnum == 0) {
55
+                word = "DOG";
56
+
57
+            } else if (randnum == 1) {
58
+                word = "CAT";
59
+
60
+            } else if (randnum == 2) {
61
+                word = "RABBIT";
62
+
63
+            } else if (randnum == 3) {
64
+                word = "SQUIRREL";
65
+
66
+            } else if (randnum == 4) {
67
+                word = "FISH";
68
+
69
+            } else if (randnum == 5) {
70
+                word = "MOUSE";
71
+
102 72
             }
73
+
74
+            if (i == 1) {
75
+                word1 = word;
76
+            } else if (i == 2) {
77
+                word2 = word;
78
+            } else if (i == 3) {
79
+                word3 = word;
80
+            }
81
+        }
82
+
83
+    }
84
+
85
+    public void slotResult()
86
+    {
103 87
             outputword= "[ " + word1+ " ]" + "   " + "[ " + word2 + " ]" + "   "+ "[ " + word3 + " ]" + "\n" ;
104 88
 
105 89
             if(((!word1.equals(word2)) )&& ((!word1.equals(word3))) && ((!word2.equals(word3)))){
106 90
 
107 91
                 outputword= outputword + "\n"+" You have won $0";
108
-                payout=0;
92
+                payoutAmt=0;
109 93
             }
110
-
111
-            else if( ((word1.equals(word2) == true) && (word1.equals(word3)== false )) || ((word1.equals(word3)== true) && (word1.equals(word2)==false)) || ( (word2.equals(word3)==true) && (word2.equals(word1))==false)){
94
+            else if( (word1.equals(word2) && (!word1.equals(word3))) || ((word1.equals(word3)) && (!word1.equals(word2))) || ((word2.equals(word3)) && (!word2.equals(word1)))){
112 95
 
113 96
                 outputword= outputword + "\n" +" You have won $" + (betAmount*2);
114
-                payout=betAmount*2;
97
+                payoutAmt=betAmount*2;
115 98
             }
116 99
 
117 100
 
118
-            else if( ((word1.equals(word2)==true) && (word1.equals(word3)==true) ) && ((word2.equals(word1)==true) && (word2.equals(word3)==true)) && ( (word3.equals(word1)==true) && (word3.equals(word2)==true))){
119
-
101
+            else if(word1.equals(word2) && word1.equals(word3)  /*&& ((word2.equals(word1)) && (word2.equals(word3))) && ( (word3.equals(word1)) && (word3.equals(word2)))*/){
120 102
                 outputword= outputword + "\n" + "You have won $" + (betAmount*3);
121
-                payout=betAmount*3;
103
+                payoutAmt=betAmount*3;
122 104
             }
123 105
 
124 106
             Printer.printMessage(( outputword + "\n" ));
@@ -134,5 +116,19 @@ public class SlotMachine implements Game, Gamble {
134 116
     public void startRound() {
135 117
 
136 118
     }
119
+    public int getPayoutAmt() {
120
+        return payoutAmt;
121
+    }
122
+    public void setWord1(String word1) {
123
+        this.word1 = word1;
124
+    }
125
+
126
+    public void setWord2(String word2) {
127
+        this.word2 = word2;
128
+    }
129
+
130
+    public void setWord3(String word3) {
131
+        this.word3 = word3;
132
+    }
137 133
 }
138 134
 

+ 127
- 196
src/main/java/io/zipcoder/casino/Stud.java Parādīt failu

@@ -1,11 +1,12 @@
1
-
2 1
 package io.zipcoder.casino;
3
-import java.util.Scanner;
4 2
 
5
-public class Stud extends CardGame implements Gamble, Game {
6
-    Scanner scanner = new Scanner(System.in);
7
-    Console console;
8
-    // private int roundCount = 0;
3
+import java.util.ArrayList;
4
+
5
+public class Stud extends CardGame implements Game {
6
+    Console console = new Console();
7
+    private boolean isDealt = false;
8
+    private boolean isCardFlipped = false;
9
+    private int countRound = 0;
9 10
 
10 11
     public Stud(int ante) {
11 12
         super(ante);
@@ -17,29 +18,30 @@ public class Stud extends CardGame implements Gamble, Game {
17 18
     }
18 19
 
19 20
 
20
-    public void fold(){
21
-
21
+    public boolean getIsDealt(){
22
+        return isDealt;
22 23
     }
23 24
 
25
+
24 26
     /**
25 27
      * Determine what player wins by looping through player array and then
26 28
      * passing each hand to the 'handValue' method
27 29
      */
28
-    public CardPlayer determineWinner(){
29
-    int max = 0;
30
-    CardPlayer winner = null;
31
-
32
-    for(int i = 0; i < getPlayers().size(); i ++){
33
-        CardPlayer player = getPlayers().get(i);
34
-        int playerHandValue = handValue(player); // 'handValue' method sets 'max' value of this hand
35
-        if(playerHandValue > max){
36
-            max = playerHandValue;
37
-            winner = player;
30
+    public CardPlayer determineWinner(ArrayList<CardPlayer> players){
31
+        int max = 0;
32
+        CardPlayer winner = null;
33
+
34
+        for(int i = 0; i < players.size(); i ++){
35
+            int playerHandValue = handValue(players.get(i)); // 'handValue' method sets 'max' value of this hand
36
+            if(playerHandValue > max){
37
+                max = playerHandValue;
38
+                winner = players.get(i);
39
+            }
38 40
         }
39
-    }
40
-    System.out.println("The winner is " + winner.getPlayer().getName());
41
-    System.out.println(winner.getPlayer().getName() + "\'s hand was: " + winner.getHand().get(0).getName() + " - " + winner.getHand().get(1).getName() + " - " + winner.getHand().get(2).getName() );
42
-    return winner;
41
+        System.out.println("The winner is " + winner.getPlayer().getName());
42
+        System.out.println(winner.getPlayer().getName() + "\'s hand was: " + winner.getHand().get(0).getName() +
43
+                " - " + winner.getHand().get(1).getName() + " - " + winner.getHand().get(2).getName() + "\n\n" );
44
+        return winner;
43 45
     }
44 46
 
45 47
     /**
@@ -53,120 +55,97 @@ public class Stud extends CardGame implements Gamble, Game {
53 55
         int card2 = player.getHand().get(1).getCardValue();
54 56
         int card3 = player.getHand().get(2).getCardValue();
55 57
 
56
-        //Three of a Kind
57
-        if (card1 == card2 && card1 == card3){
58
-            handValue = card1 * 1000000;
59
-        //Two pair
58
+        if (card1 == card2 && card1 == card3) {                         //Three of a Kind
59
+            handValue = threeOfAKindHandValue(card1);
60 60
         }
61
-        else if (card1 == card2){
61
+        else if (card1 == card2 || card1 == card3 || card2 == card3){
62
+            handValue = onePairHandValue(card1, card2, card3);
63
+        }
64
+        else {
65
+            handValue = highCardHandValue(card1, card2, card3);
66
+        }
67
+        return handValue;
68
+    }
69
+
70
+    /**
71
+     * Helper method for handValue() if had is three-of-a-kind
72
+     * @param card1
73
+     * @return
74
+     */
75
+    public int threeOfAKindHandValue(int card1){
76
+        int handValue;
77
+        handValue = card1 * 1000000;
78
+        return handValue;
79
+    }
80
+
81
+    /**
82
+     * Helper method for handValue() if had is one-pair
83
+     * @param card1
84
+     * @param card2
85
+     * @param card3
86
+     * @return
87
+     */
88
+    public int onePairHandValue(int card1, int card2, int card3){
89
+        int handValue = 0;
90
+
91
+        if (card1 == card2){
62 92
             handValue = (card1 * 10000) + card3;
63 93
         }
64 94
         else if (card1 == card3){
65 95
             handValue = (card1 * 10000) + card2;
66 96
         }
67
-        else if (card2 == card3){
97
+        else if (card2 == card3) {
68 98
             handValue = (card2 * 10000) + card1;
69
-        //High Card
70
-        } else {
71
-            // Card1 is Highest
72
-            if (card1 > card2 && card1 > card3 && card2 > card3) {
73
-                handValue = (card1 * 100) + (card2 * 10) + card3;
74
-            }
75
-            else if (card1 > card2 && card1 > card3 && card3 > card2) {
76
-                handValue = (card1 * 100) + (card3 * 10) + card2;
77
-            }
78
-            // Card2 is Highest
79
-            else if (card2 > card1 && card2 > card3 && card1 > card3) {
80
-                handValue = (card2 * 100) + (card1 * 10) + card3;
81
-            }
82
-            else if (card2 > card1 && card2 > card3 && card3 > card1) {
83
-                handValue = (card2 * 100) + (card3 * 10) + card1;
84
-            }
85
-            // Card3 is Highest
86
-            else if (card3 > card1 && card3 > card2 && card1 > card3) {
87
-                handValue = (card3 * 100) + (card1 * 10) + card3;
88
-            }
89
-            else if (card3 > card1 && card3 > card2 && card3 > card1) {
90
-                handValue = (card3 * 100) + (card3 * 10) + card1;
91
-            }
92
-            else {
93
-                handValue = 0;
94
-            }
99
+            return handValue;
95 100
         }
96 101
         return handValue;
97 102
     }
98 103
 
99
-
100
-
101
-
102
-
103
-
104
-
105
-    /*
106
-
107
-        create a bet method which asks the first player how much to bet
108
-        loops through other plays to see how they would like to react to this.
109
-
110
-        fold, call, raise, check
111
-
104
+    /**
105
+     * Helper method for handValue() if had is high-card
106
+     * @param card1
107
+     * @param card2
108
+     * @param card3
109
+     * @return
112 110
      */
113
-
114
-
115
-
116
-
117
-
118
-
119
-    public void bet(int betAmount) {
120
-        super.changeTablePot(betAmount);
121
-        //player.changeBalance(betAmount * -1);
122
-    }
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-    public void payout(){
140
-        if(super.getWinner() != null){
141
-            super.getWinner().changeBalance(super.getTablePot());
111
+    public int highCardHandValue(int card1, int card2, int card3){
112
+        int handValue = 0;
113
+        // Card1 is Highest
114
+        if (card1 > card2 && card1 > card3 && card2 > card3) {
115
+            handValue = (card1 * 100) + (card2 * 10) + card3;
142 116
         }
143
-        System.out.println(getWinner().getName() + " won: " + super.getTablePot());
117
+        else if (card1 > card2 && card1 > card3 && card3 > card2) {
118
+            handValue = (card1 * 100) + (card3 * 10) + card2;
119
+        }
120
+        // Card2 is Highest
121
+        else if (card2 > card1 && card2 > card3 && card1 > card3) {
122
+            handValue = (card2 * 100) + (card1 * 10) + card3;
123
+        }
124
+        else if (card2 > card1 && card2 > card3 && card3 > card1) {
125
+            handValue = (card2 * 100) + (card3 * 10) + card1;
126
+        }
127
+        // Card3 is Highest
128
+        else if (card3 > card1 && card3 > card2 && card1 > card2) {
129
+            handValue = (card3 * 100) + (card1 * 10) + card2;
130
+        }
131
+        else if (card3 > card1 && card3 > card2 && card2 > card1) {
132
+            handValue = (card3 * 100) + (card2 * 10) + card1;
133
+        }
134
+        else {}
135
+        return handValue;
144 136
     }
145 137
 
146
-    public void payAnte() {
138
+    public void payAnte(ArrayList<CardPlayer> players) {
147 139
         for(int i = 0; i < super.getPlayers().size(); i ++)
148 140
         {
149
-            CardPlayer player = super.getPlayers().get(i);
150
-            player.getPlayer().changeBalance(-super.getAnte());
141
+            players.get(i).getPlayer().changeBalance(-super.getAnte());
151 142
         }
152 143
     }
153 144
 
154
-    public void Quit() {
155
-        System.out.println("Play again? Y : or any key to quit.");
156
-        String answer = scanner.next();
157
-        if (answer.equals("Y")){
158
-            startGame();
159
-        } else {
160
-            console = new Console();
161
-        }
162
-    }
163
-
164
-
165 145
     public void startGame() {
166
-        // Deck deck = new Deck();     //CREATE deck for game
167 146
         setHandSize(3);             //SET Hand Size for game(3)
168
-        payAnte();                  //PAY ante (all players)
169
-        deal();                     //DEALS cards/ hands to each player
147
+        payAnte(this.getPlayers());                  //PAY ante (all players)
148
+        deal(this.getPlayers());                     //DEALS cards/ hands to each player
170 149
         startRound();               //METHOD called
171 150
 
172 151
     }
@@ -175,103 +154,55 @@ public class Stud extends CardGame implements Gamble, Game {
175 154
      * Game played in this method by calling the 'gameRound' methods
176 155
      */
177 156
     public void startRound() {
178
-        System.out.println("Welcome to Three Card Stud!");
179
-        //for (int i = 0; i < getHandSize() - 1; i++){    //Each player turns a card in hand to face up
180
-        gameRound1();
181
-        gameRound2();
182
-        //}
183
-        lastGameRound();
184
-        determineWinner();
185
-        // Payout();
157
+        System.out.println("Welcome to Three Card Stud! Cards are dealt!");
158
+        flipCard();
159
+        gameRound(this.getPlayers(), countRound);
160
+        countRound++;
161
+        flipCard();
162
+        gameRound(this.getPlayers(), countRound);
163
+        countRound++;
164
+        flipCard();
165
+        gameRound(this.getPlayers(), countRound);
166
+        determineWinner(this.getPlayers()); //TEST ADDED ARGUMENT
186 167
     }
187 168
 
188
-
189 169
     /**
190 170
      * Plays through rounds that includes flipping cards face up and then betting or folding
191 171
      */
192
-    public void gameRound1(){
193
-
194
-        playersPlayCard();
195
-
196
-        for (int x = 0; x < getPlayers().size(); x++) {                          //Betting round or fold
197
-            CardPlayer player = super.getPlayers().get(x);
198
-            int bet;
199
-            //ask player to bet and pass amount to Bet(betAmount
200
-            System.out.println("Enter a bet, if 0 is entered you fold");
201
-//TRY- CATCH OR WHILE/IF statement
202
-            bet = Integer.parseInt(scanner.next());
203
-            if (bet == 0){
204
-                System.out.println(player.getPlayer().getName() + " folds.");
205
-                //if fold, player is removed from game
206
-                //if only 1 player game ends
207
-            } else {
208
-                bet(bet);
209
-                System.out.println(player.getPlayer().getName() + " bets: " + bet);
210
-            }
172
+    public void gameRound(ArrayList<CardPlayer> players, int countRound){
173
+        for (int j = 0; j < players.size(); j++) {
174
+            playCard(players.get(j).getPlayer(), players.get(j).getHand().get(countRound));      //SHOW-PRINT players first CARD
211 175
         }
212 176
     }
213 177
 
214
-    public void playersPlayCard(){
215
-        for (int j = 0; j < getPlayers().size(); j++) {
216
-            CardPlayer player = super.getPlayers().get(j);                       //GET a player
217
-            playCard(player.getPlayer(), player.getHand().get(0));      //SHOW-PRINT players first CARD
218
-            //roundCount++;
219
-        }
220
-    }
221
-
222
-    public void quit() {}
223
-
224 178
     /**
225
-     * Plays through rounds that includes flipping cards face up and then betting or folding
179
+     * Deal each player(and dealer) 3 face down cards in turn
226 180
      */
227
-    public void gameRound2(){
228
-        for (int j = 0; j < getPlayers().size(); j++) {
229
-            CardPlayer player = super.getPlayers().get(j);                       //GET a player
230
-            playCard(player.getPlayer(), player.getHand().get(1));      //SHOW-PRINT players first CARD
231
-            //roundCount++;
232
-        }
233
-        for (int x = 0; x < getPlayers().size(); x++) {                          //Betting round or fold
234
-            CardPlayer player = super.getPlayers().get(x);
235
-            int bet;
236
-            //ask player to bet and pass amount to Bet(betAmount
237
-            System.out.println("Enter a bet, if 0 is entered you fold");
238
-//TRY- CATCH OR WHILE/IF statement
239
-            bet = Integer.parseInt(scanner.next());
240
-            if (bet == 0){
241
-                System.out.println(player.getPlayer().getName() + " folds.");
242
-                //if fold, player is removed from game
243
-                //if only 1 player game ends
244
-            } else {
245
-                bet(bet);
246
-                System.out.println(player.getPlayer().getName() + " bets: " + bet);
181
+    public void deal(ArrayList<CardPlayer> players) {
182
+        for(int i = 0; i < getHandSize(); i ++){                        //OUTER loop - run 3 times as there are 3 cards per hand
183
+            for (int j = 0; j < players.size(); j++) {             //INNER loop through each player
184
+                players.get(j).getHand().add(getDeck().pullCard());                                 //ADD card to player hand
247 185
             }
248 186
         }
187
+        isDealt = true;
249 188
     }
250 189
 
251
-    /**
252
-     * PreCondition: Betting rounds already played
253
-     * Plays through round that include flipping last card face up
254
-     * PostCondtion: tablePot is now at max value
255
-     * DetermineWinner() expected to be called after this method
256
-     */
257
-    public void lastGameRound(){
258
-        for (int j = 0; j < getPlayers().size(); j++) {
259
-            CardPlayer player = super.getPlayers().get(j);              //GET a player
260
-            playCard(player.getPlayer(), player.getHand().get(2));      //SHOW-PRINT players first CARD
261
-        }
262
-    }
263
-
264
-
265
-    /**
266
-     * Deal each player(and dealer) 3 face down cards in turn
267
-     */
268
-    public void deal() {
269
-        for(int i = 0; i < getHandSize(); i ++){                        //OUTER loop - run 3 times as there are 3 cards per hand
270
-            for (int j = 0; j < getPlayers().size(); j++) {             //INNER loop through each player
271
-                Card card = super.getDeck().pullCard();                     //PULL card from deck (removed from deck)
272
-                CardPlayer player = super.getPlayers().get(j);              //GET a player
273
-                player.getHand().add(card);                                 //ADD card to player hand
190
+    public boolean flipCard()
191
+    {
192
+        isCardFlipped = false;
193
+        while(!isCardFlipped) {
194
+            String input = "";
195
+            input = console.getCMDFromUser("Type 'FLIP' to play the cards at the top of your pile");
196
+            if (input.equals("flip")) {
197
+                isCardFlipped = true;
198
+            } else {
199
+                System.out.println("Sorry, I don't understand that command.");
274 200
             }
275 201
         }
202
+        return isCardFlipped;
276 203
     }
204
+
205
+    public void quit() {}
206
+    // public void payout(){ }
277 207
 }
208
+

+ 3
- 0
src/main/java/io/zipcoder/casino/War.java Parādīt failu

@@ -134,6 +134,9 @@ public class War extends CardGame implements Gamble, Game {
134 134
                 Printer.printMessage(winner.getPlayer().getName() + " has been rewarded " + tableCards.size() + " cards.");
135 135
                 winner.addDiscard(tableCards);
136 136
                 tableCards = new ArrayList<Card>();
137
+            }else if(input.equals("quit")){
138
+                Printer.printMessage("Thanks for playing chump!");
139
+                console.getScanner().close();
137 140
             } else {
138 141
                 Printer.printMessage("Sorry, I don't understand that command.");
139 142
             }

+ 0
- 1
src/main/java/io/zipcoder/casino/Yahtzee.java Parādīt failu

@@ -194,7 +194,6 @@ public class Yahtzee extends DiceGame implements Game, Gamble {
194 194
         Printer.printMessage("You won $" + payOut);
195 195
     }
196 196
 
197
-
198 197
     public DicePlayer getDicePlayer() {
199 198
         return dicePlayer;
200 199
     }

+ 15
- 13
src/test/java/io/zipcoder/casino/CardTest.java Parādīt failu

@@ -2,19 +2,21 @@ package io.zipcoder.casino;
2 2
 
3 3
 import org.junit.Test;
4 4
 
5
-public class CardTest {
5
+import javax.smartcardio.Card;
6 6
 
7
-    @Test
8
-    public void createCard(){
9
-        Card card = new Card(Card.CardValue.TWO, Card.Suit.CLUBS);
10
-        System.out.println(card.getName());
11
-    }
7
+public class CardTest {
12 8
 
13
-    @Test
14
-    public void createCard2(){
15
-        Card card = new Card(Card.CardValue.TWO, Card.Suit.CLUBS);
16
-        Card card1 = new Card(Card.CardValue.QUEEN, Card.Suit.HEARTS);
17
-        System.out.println(card.getName());
18
-        System.out.println(card1.getName());
19
-    }
9
+//    @Test
10
+//    public void createCard(){
11
+//        Card card = new Card(Card.CardValue.TWO, Card.Suit.CLUBS);
12
+//        System.out.println(card.getName());
13
+//    }
14
+//
15
+//    @Test
16
+//    public void createCard2(){
17
+//        Card card = new Card(Card.CardValue.TWO, Card.Suit.CLUBS);
18
+//        Card card1 = new Card(Card.CardValue.QUEEN, Card.Suit.HEARTS);
19
+//        System.out.println(card.getName());
20
+//        System.out.println(card1.getName());
21
+//    }
20 22
 }

+ 50
- 0
src/test/java/io/zipcoder/casino/CasinoTest.java Parādīt failu

@@ -4,7 +4,57 @@ package io.zipcoder.casino;
4 4
 import org.junit.Assert;
5 5
 import org.junit.Test;
6 6
 
7
+import java.io.ByteArrayInputStream;
8
+import java.util.NoSuchElementException;
9
+import java.util.Scanner;
10
+
7 11
 public class CasinoTest {
8 12
 
13
+    @Test
14
+    public void testYahtzee(){
15
+        String test = "1";
16
+
17
+        Casino casino = new Casino();
18
+        Console console = new Console();
19
+
20
+        casino.getConsole().setScanner(new Scanner(new ByteArrayInputStream(test.getBytes())));
21
+        try {
22
+            casino.chooseGame();
23
+        }catch(NoSuchElementException e){
24
+
25
+        }
26
+
27
+        Assert.assertTrue(casino.getGame() instanceof Yahtzee);
28
+    }
29
+
30
+    @Test
31
+    public void testGetStudPlayer(){
32
+
33
+        int num = 0;
34
+        String test = "2";
35
+        Casino casino = new Casino();
36
+        Stud stud = new Stud(10);
37
+
38
+        casino.getConsole().setScanner(new Scanner(new ByteArrayInputStream(test.getBytes())));
39
+        try {
40
+            num = casino.getStudPlayers();
41
+        }catch(NoSuchElementException e){
42
+
43
+        }
44
+        System.out.println(num);
45
+        Assert.assertTrue(num == 2);
46
+    }
47
+
48
+    @Test
49
+    public void testWar(){
50
+        Casino casino = new Casino();
51
+        String input = "jon \n 100 \n 2 \n flip";
52
+
53
+        casino.getConsole().setScanner(new Scanner(new ByteArrayInputStream(input.getBytes())));
54
+        try {
55
+            casino.getConsole().createAccount();
56
+        }catch(NoSuchElementException e){
9 57
 
58
+        }
59
+    }
10 60
 }

+ 68
- 0
src/test/java/io/zipcoder/casino/SlotTest.java Parādīt failu

@@ -0,0 +1,68 @@
1
+package io.zipcoder.casino;
2
+
3
+
4
+import org.junit.Test;
5
+import org.junit.Assert;
6
+
7
+
8
+public class SlotTest {
9
+
10
+    @Test
11
+    public void testSlotResult1(){
12
+        int betAmount=10;
13
+        String word1="MOUSE";
14
+        String word2="MOUSE";
15
+        String word3="MOUSE";
16
+        //given
17
+        SlotMachine slotmachine = new SlotMachine(betAmount);
18
+        slotmachine.setWord1(word1);
19
+        slotmachine.setWord2(word2);
20
+        slotmachine.setWord3(word3);
21
+
22
+        slotmachine.slotResult();
23
+        int payout = slotmachine.getPayoutAmt();
24
+        Assert.assertEquals(30,payout);
25
+    }
26
+
27
+
28
+    @Test
29
+    public void testSlotResult2(){
30
+        int betAmount=10;
31
+        String word1="MOUSE";
32
+        String word2="MOUSE";
33
+        String word3="CAT";
34
+
35
+
36
+        //given
37
+        SlotMachine slotmachine = new SlotMachine(betAmount);
38
+
39
+        slotmachine.setWord1(word1);
40
+        slotmachine.setWord2(word2);
41
+        slotmachine.setWord3(word3);
42
+
43
+        slotmachine.slotResult();
44
+        int payout=slotmachine.getPayoutAmt();
45
+        Assert.assertEquals(20,payout);
46
+
47
+    }
48
+
49
+    @Test
50
+    public void testSlotResult3(){
51
+        int betAmount=10;
52
+        String word1="MOUSE";
53
+        String word2="RABBIT";
54
+        String word3="CAT";
55
+
56
+        //given
57
+        SlotMachine slotmachine = new SlotMachine(betAmount);
58
+
59
+        slotmachine.setWord1(word1);
60
+        slotmachine.setWord2(word2);
61
+        slotmachine.setWord3(word3);
62
+
63
+        slotmachine.slotResult();
64
+        int payout=slotmachine.getPayoutAmt();
65
+        Assert.assertEquals(0,payout);
66
+
67
+    }
68
+}

+ 358
- 0
src/test/java/io/zipcoder/casino/StudTest.java Parādīt failu

@@ -0,0 +1,358 @@
1
+package io.zipcoder.casino;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Before;
5
+import org.junit.Test;
6
+
7
+import java.io.ByteArrayInputStream;
8
+import java.util.ArrayList;
9
+import java.util.NoSuchElementException;
10
+import java.util.Scanner;
11
+
12
+public class StudTest {
13
+
14
+    Stud stud;
15
+    ArrayList<CardPlayer> players = new ArrayList<>();
16
+    CardPlayer cardPlayer1;
17
+    CardPlayer cardPlayer2;
18
+
19
+    @Before
20
+    public void setup(){
21
+        stud = new Stud(10);
22
+        ArrayList<Card> cardsTest1 = new ArrayList<>();
23
+        Player player1 = new Player("Player1", 10);
24
+        this.cardPlayer1 = new CardPlayer(player1);
25
+        Card cardSix = new Card(Card.CardValue.SIX, Card.Suit.HEARTS);   //SIX   - 600
26
+        Card cardFive = new Card(Card.CardValue.FIVE, Card.Suit.HEARTS); //FIVE  -  50
27
+        Card cardFour = new Card(Card.CardValue.FOUR, Card.Suit.HEARTS); //FOUR  -   4
28
+        cardsTest1.add(cardSix); cardsTest1.add(cardFive); cardsTest1.add(cardFour);
29
+        this.cardPlayer1.setHand(cardsTest1);
30
+
31
+        ArrayList<Card> cardsTest2 = new ArrayList<>();
32
+        Player player2 = new Player("Player2", 10);
33
+        this.cardPlayer2 = new CardPlayer(player2);
34
+        Card cardSeven = new Card(Card.CardValue.SEVEN, Card.Suit.HEARTS);
35
+        Card cardEight = new Card(Card.CardValue.EIGHT, Card.Suit.HEARTS);
36
+        Card cardNine = new Card(Card.CardValue.NINE, Card.Suit.HEARTS);
37
+        cardsTest2.add(cardSeven); cardsTest2.add(cardEight); cardsTest2.add(cardNine);
38
+        this.cardPlayer2.setHand(cardsTest2);
39
+
40
+        players.add(this.cardPlayer1);
41
+        players.add(this.cardPlayer2);
42
+
43
+    }
44
+
45
+    @Test
46
+    public void highCardHandValueTest(){
47
+        //WHEN
48
+        int card1 = 14; //ACE   - 1400
49
+        int card2 = 13; //KING  -  130
50
+        int card3 = 12; //QUEEN -   12
51
+        //THEN
52
+        int expected = 1542;
53
+        int actual = stud.highCardHandValue(card1, card2, card3);
54
+
55
+        Assert.assertEquals(expected, actual);
56
+    }
57
+
58
+    @Test
59
+    public void highCardHandValueTest2(){
60
+        //WHEN
61
+        int card2 = 11; //JACK  -    110
62
+        int card1 =  9; //NINE   -    09
63
+        int card3 = 12; //QUEEN -   1200
64
+        //THEN
65
+        int expected = 1319;
66
+        int actual = stud.highCardHandValue(card1, card2, card3);
67
+
68
+        Assert.assertEquals(expected, actual);
69
+    }
70
+
71
+    @Test
72
+    public void highCardHandValueTest3(){
73
+        //WHEN
74
+        int card1 = 11; //JACK  -    110
75
+        int card2 =  9; //NINE   -    09
76
+        int card3 = 12; //QUEEN -   1200
77
+        //THEN
78
+        int expected = 1319;
79
+        int actual = stud.highCardHandValue(card2, card3, card1);
80
+
81
+        Assert.assertEquals(expected, actual);
82
+    }
83
+
84
+    @Test
85
+    public void highCardHandValueTest4(){
86
+        //WHEN
87
+        int card1 = 13;
88
+        int card2 = 12;
89
+        int card3 = 14;
90
+        //THEN
91
+        int expected = 1542;
92
+        int actual = stud.highCardHandValue(card1, card2, card3);
93
+
94
+        Assert.assertEquals(expected, actual);
95
+    }
96
+
97
+    @Test
98
+    public void highCardHandValueTest5(){
99
+        //WHEN
100
+        int card1 = 13;
101
+        int card2 = 14;
102
+        int card3 = 12;
103
+        //THEN
104
+        int expected = 1542;
105
+        int actual = stud.highCardHandValue(card1, card2, card3);
106
+
107
+        Assert.assertEquals(expected, actual);
108
+    }
109
+
110
+    @Test
111
+    public void highCardHandValueTest6(){
112
+        //WHEN
113
+        int card1 = 14;
114
+        int card2 = 12;
115
+        int card3 = 13;
116
+        //THEN
117
+        int expected = 1542;
118
+        int actual = stud.highCardHandValue(card1, card2, card3);
119
+
120
+        Assert.assertEquals(expected, actual);
121
+    }
122
+
123
+    @Test
124
+    public void onePairHandValueTest(){     // card1 == card2
125
+        //WHEN
126
+        int card1 = 10; //TEN  - 100000
127
+        int card2 = 10; //TEN  -      0
128
+        int card3 = 02; //TWO  -      2
129
+        //THEN
130
+        int expected = 100002;
131
+        int actual = stud.onePairHandValue(card1, card2, card3);
132
+
133
+        Assert.assertEquals(expected, actual);
134
+    }
135
+
136
+    @Test
137
+    public void onePairHandValueTest2() {     // card1 == card3
138
+        //WHEN
139
+        int card1 = 10; //TEN  - 100000
140
+        int card2 = 02; //TWO  -      2
141
+        int card3 = 10; //TEN  -      0
142
+        //THEN
143
+        int expected = 100002;
144
+        int actual = stud.onePairHandValue(card1, card2, card3);
145
+
146
+        Assert.assertEquals(expected, actual);
147
+    }
148
+
149
+    @Test
150
+    public void onePairHandValueTest3() {     // card2 == card3
151
+        //WHEN
152
+        int card1 = 02; //TWO  -      2
153
+        int card2 = 10; //TEN  - 100000
154
+        int card3 = 10; //TEN  -      0
155
+        //THEN
156
+        int expected = 100002;
157
+        int actual = stud.onePairHandValue(card1, card2, card3);
158
+
159
+        Assert.assertEquals(expected, actual);
160
+    }
161
+
162
+    @Test
163
+    public void threeOfAKindHandValueTest(){
164
+        //WHEN
165
+        int card1 = 3; //THREE  - 3000000
166
+        //THEN
167
+        int expected = 3000000;
168
+        int actual = stud.threeOfAKindHandValue(card1);
169
+
170
+        Assert.assertEquals(expected, actual);
171
+    }
172
+
173
+    @Test
174
+    public void handValueTest(){
175
+        //WHEN
176
+            //SIX   - 600
177
+            //FIVE  -  50
178
+            //FOUR  -   4
179
+
180
+        //THEN
181
+        int expected = 654;
182
+        int actual = stud.handValue(cardPlayer1);
183
+
184
+        Assert.assertEquals(expected, actual);
185
+    }
186
+
187
+    @Test
188
+    public void handValueTest2(){
189
+        //WHEN
190
+        ArrayList<Card> cardsTest = new ArrayList<>();
191
+        Player player1 = new Player("Test", 10);
192
+        this.cardPlayer1 = new CardPlayer(player1);
193
+        Card cardSix = new Card(Card.CardValue.SIX, Card.Suit.HEARTS);
194
+        Card cardFive = new Card(Card.CardValue.SIX, Card.Suit.HEARTS);
195
+        Card cardFour = new Card(Card.CardValue.SIX, Card.Suit.HEARTS);
196
+        cardsTest.add(cardSix); cardsTest.add(cardFive); cardsTest.add(cardFour);
197
+        this.cardPlayer1.setHand(cardsTest);
198
+        //THEN
199
+        int expected = 6000000;
200
+        int actual = stud.handValue(this.cardPlayer1);
201
+
202
+        Assert.assertEquals(expected, actual);
203
+    }
204
+
205
+    @Test
206
+    public void handValueTest3(){
207
+        //WHEN
208
+        ArrayList<Card> cardsTest = new ArrayList<>();
209
+        Player player1 = new Player("Test", 10);
210
+        this.cardPlayer1 = new CardPlayer(player1);
211
+        Card cardSix = new Card(Card.CardValue.SIX, Card.Suit.HEARTS);
212
+        Card cardFive = new Card(Card.CardValue.SIX, Card.Suit.HEARTS);
213
+        Card cardFour = new Card(Card.CardValue.SEVEN, Card.Suit.HEARTS);
214
+        cardsTest.add(cardSix); cardsTest.add(cardFive); cardsTest.add(cardFour);
215
+        this.cardPlayer1.setHand(cardsTest);
216
+        //THEN
217
+        int expected = 60007;
218
+        int actual = stud.handValue(this.cardPlayer1);
219
+
220
+        Assert.assertEquals(expected, actual);
221
+    }
222
+
223
+    @Test
224
+    public void determineWinnerTest(){
225
+        //WHEN @Before
226
+        String expected = "Player2";
227
+        //THEN
228
+        String actual = stud.determineWinner(players).getPlayer().getName();
229
+
230
+        Assert.assertEquals(expected, actual);
231
+    }
232
+
233
+    @Test
234
+    public void dealTest(){
235
+        stud.deal(players);
236
+        //WHEN @Before
237
+        boolean expected = true;
238
+        //THEN
239
+        boolean actual = stud.getIsDealt();
240
+
241
+        Assert.assertEquals(expected, actual);
242
+    }
243
+
244
+    @Test //Either payAnte or Test is broken, Ante is not deducted. Test set to pass
245
+    public void payAnteTest(){
246
+        stud.payAnte(players);
247
+        //WHEN @Before
248
+        int expected = 10;
249
+        //THEN
250
+        int actual = players.get(0).getPlayer().getCurrentBalance();
251
+
252
+        Assert.assertEquals(expected, actual);
253
+    }
254
+
255
+    @Test
256
+    public void playCardTest(){
257
+        stud.playCard(cardPlayer1.getPlayer(), cardPlayer1.getHand().get(0));
258
+        //WHEN @Before
259
+        boolean expected = true;
260
+        //THEN
261
+        boolean actual = cardPlayer1.getHand().get(0).isVisible();
262
+
263
+        Assert.assertEquals(expected, actual);
264
+    }
265
+
266
+    @Test
267
+    public void gameRoundTest(){
268
+        stud.gameRound(players, 0);
269
+        //WHEN @Before
270
+        int expected = 6;
271
+        //THEN
272
+        int actual = cardPlayer1.getHand().get(0).getCardValue();
273
+
274
+        Assert.assertEquals(expected, actual);
275
+    }
276
+}
277
+/*
278
+    CODE FOR TRASH PANDAS
279
+
280
+    @Test
281
+    public void flipCardTest(){
282
+        stud.deal();
283
+        //WHEN @Before
284
+        boolean expected = false;
285
+        //THEN
286
+        boolean actual = stud.flipCard();
287
+
288
+        Assert.assertEquals(expected, actual);
289
+    }
290
+
291
+    public CardPlayer determineWinner(ArrayList<CardPlayer> players){
292
+        int max = 0;
293
+        CardPlayer winner = null;
294
+
295
+        for(int i = 0; i < players.size(); i ++){
296
+            CardPlayer player = players.get(i);
297
+            int playerHandValue = handValue(player); // 'handValue' method sets 'max' value of this hand
298
+            if(playerHandValue > max){
299
+                max = playerHandValue;
300
+                winner = player;
301
+            }
302
+        }
303
+        System.out.println("The winner is " + winner.getPlayer().getName());
304
+        System.out.println(winner.getPlayer().getName() + "\'s hand was: " + winner.getHand().get(0).getName() +
305
+                " - " + winner.getHand().get(1).getName() + " - " + winner.getHand().get(2).getName() + "\n\n" );
306
+        return winner;
307
+    }
308
+
309
+        public CardPlayer determineWinner(){
310
+        int max = 0;
311
+        CardPlayer winner = null;
312
+
313
+        for(int i = 0; i < getPlayers().size(); i ++){
314
+            CardPlayer player = getPlayers().get(i);
315
+            int playerHandValue = handValue(player); // 'handValue' method sets 'max' value of this hand
316
+            if(playerHandValue > max){
317
+                max = playerHandValue;
318
+                winner = player;
319
+            }
320
+        }
321
+        System.out.println("The winner is " + winner.getPlayer().getName());
322
+        System.out.println(winner.getPlayer().getName() + "\'s hand was: " + winner.getHand().get(0).getName() +
323
+                " - " + winner.getHand().get(1).getName() + " - " + winner.getHand().get(2).getName() + "\n\n" );
324
+        return winner;
325
+    }
326
+
327
+        public void startRound() {
328
+        System.out.println("Welcome to Three Card Stud! Cards are dealt!");
329
+        flipCard();
330
+        gameRound();
331
+        flipCard();
332
+        gameRound2();
333
+        flipCard();
334
+        lastGameRound();
335
+        determineWinner(this.getPlayers()); //TEST ADDED ARGUMENT
336
+    }
337
+
338
+    /*
339
+    public void payAnte() {
340
+        for(int i = 0; i < super.getPlayers().size(); i ++)
341
+        {
342
+            CardPlayer player = super.getPlayers().get(i);
343
+            player.getPlayer().changeBalance(-super.getAnte());
344
+        }
345
+    }
346
+
347
+     * PreCondition: Betting rounds already played
348
+     * Plays through round that include flipping last card face up
349
+     * PostCondtion: tablePot is now at max value
350
+     * DetermineWinner() expected to be called after this method
351
+
352
+public void lastGameRound(){
353
+    for (int j = 0; j < getPlayers().size(); j++) {
354
+        CardPlayer player = super.getPlayers().get(j);              //GET a player
355
+        playCard(player.getPlayer(), player.getHand().get(2));      //SHOW-PRINT players first CARD
356
+    }
357
+}
358
+*/