Преглед на файлове

Merge branch 'Working' of cdunni/ZCW-OOP-Casino into Working

nedredmond преди 6 години
родител
ревизия
568616ad75

+ 6
- 3
src/main/java/io/zipcoder/casino/Casino.java Целия файл

@@ -34,10 +34,11 @@ public class Casino {
34 34
         int numberOfPlayers = getNumberOfPlayers();
35 35
         String playerNames = "";
36 36
         playerNames = getPlayerNames(numberOfPlayers, playerNames);
37
-        console.println(playerNames + "THANK YOU FOR JOINING US");
37
+        console.println("\n"+ playerNames + "THANK YOU FOR JOINING US");
38 38
     }
39 39
 
40 40
     private String getPlayerNames(int numberOfPlayers, String playerNames) {
41
+        console.println("");
41 42
         for (int i = 1; i <= numberOfPlayers; i++) {
42 43
           String nameOfPlayer = console.getStringInput("PLAYER " + i + ": WHAT IS YOUR NAME?");
43 44
           players.addPlayer(new Player(nameOfPlayer));
@@ -47,8 +48,10 @@ public class Casino {
47 48
     }
48 49
 
49 50
     private int getNumberOfPlayers() {
50
-        return console.getIntegerInput("WELCOME TO EPSILON CASINO, CALLED \"ALMOST A CASINO\" ON YELP\n" +
51
-                  "PLEASE ENTER A NUMBER OF PLAYERS.");
51
+        return console.getIntegerInput("*********************************\n" +
52
+                "    WELCOME TO EPSILON CASINO\n---------------------------------\n" +
53
+                "CALLED \"ALMOST A CASINO\" ON YELP\n*********************************\n" +
54
+                "\nPLEASE ENTER A NUMBER OF PLAYERS.");
52 55
     }
53 56
 
54 57
     public void chooseTable() {

+ 11
- 5
src/main/java/io/zipcoder/casino/dicegames/Craps.java Целия файл

@@ -53,7 +53,7 @@ public class Craps extends DiceGame implements Gamble {
53 53
         int sum = rollDie(2);
54 54
 
55 55
         promptEnterKey("roll dice");
56
-        console.println("Your roll sum equals: " + sum);
56
+        printRollSum(sum);
57 57
 
58 58
         simulateCraps(currentPlayer, sum);
59 59
     }
@@ -84,13 +84,13 @@ public class Craps extends DiceGame implements Gamble {
84 84
     }
85 85
 
86 86
     public void printRollAgain(int point){
87
-        console.println("\n--------------------" +
88
-                "\nPoint to roll for: " + point + "\n--------------------");
87
+        console.println("\n=====================" +
88
+                "\nPoint to roll for: " + point + "\n=====================");
89 89
         promptEnterKey("roll again");
90 90
     }
91 91
 
92 92
     public void evalReRoll(CrapsPlayer currentPlayer, int sum, int point){
93
-        console.println("You rolled a " + sum);
93
+        printRollSum(sum);
94 94
         if (sum == 7) {
95 95
             evalLoss(currentPlayer.getP());
96 96
         } else if (sum == point) {
@@ -98,6 +98,11 @@ public class Craps extends DiceGame implements Gamble {
98 98
         }
99 99
     }
100 100
 
101
+    private void printRollSum(int sum) {
102
+        console.println("------------------------\n" +
103
+                "Your roll sum equals: " + sum + " \n------------------------");
104
+    }
105
+
101 106
     public void evalLoss(Player player){
102 107
         console.println("\n*********\nYOU LOSE!\n*********\n");
103 108
         evaluateBet(player, -bet);
@@ -114,7 +119,8 @@ public class Craps extends DiceGame implements Gamble {
114 119
     }
115 120
 
116 121
     public void promptEnterKey(String str){
117
-        String input = console.getStringInput("\nPress \"ENTER\" to " + str);
122
+        String input = console.getStringInput("\n>> " +
123
+                "Press \"ENTER\" to " + str);
118 124
     }
119 125
 
120 126
     @Override

+ 6
- 4
src/main/java/io/zipcoder/casino/utilities/Console.java Целия файл

@@ -139,12 +139,14 @@ public class Console {
139 139
     }
140 140
 
141 141
     public Integer getGameChoice() {
142
-        println("GAME LIST\n");
142
+        println("\n================");
143
+        println("GAME LIST");
144
+        println("----------------");
143 145
         println("1. CRAPS\n");
144 146
         println("2. BLACK JACK\n");
145
-        println("3. GO FISH\n");
146
-        println("CHOOSE TABLE\n");
147
-        return getIntegerInput("");
147
+        println("3. GO FISH");
148
+        println("================");
149
+        return getIntegerInput("\nCHOOSE TABLE");
148 150
     }
149 151
 
150 152
 

+ 1
- 1
src/main/java/io/zipcoder/casino/utilities/abstracts/Game.java Целия файл

@@ -17,6 +17,6 @@ public abstract class Game {
17 17
 
18 18
     protected void announceGameChoice() {
19 19
         Console console = new Console();
20
-        console.println("Welcome to %s\n", this.getClassName());
20
+        console.println("\nWelcome to %s\n", this.getClassName());
21 21
     }
22 22
 }