Selaa lähdekoodia

Update 'README.md'

Kristofer Younger 6 vuotta sitten
vanhempi
commit
463fc5b720
1 muutettua tiedostoa jossa 39 lisäystä ja 1 poistoa
  1. 39
    1
      README.md

+ 39
- 1
README.md Näytä tiedosto

@@ -1,3 +1,41 @@
1 1
 # ZCW-Lab-Blackjack-BlueJ
2 2
 
3
-Make a blackjack game, play against the computer-dealer.
3
+Make a blackjack game, play against the computer-dealer. Aces are always, only, 1. 
4
+
5
+Writing a Blackjack program 
6
+
7
+Create a BlackJack class, with a runGame() method.
8
+
9
+1. Define your methods: 
10
+ - hit() or deal_card() 
11
+ - dealerDraw(dealerScore) 
12
+ - checkWin(dealerScore,playerScore) 
13
+ - isBust(score) 
14
+2. Make a variable called endGame and set it equal to False 
15
+3. Make a loop that only runs while endGame is False (i.e. the game has not ended) 
16
+4. Inside the loop, get input from the player to ask what he wants to do 
17
+  * If his input was “stick” 
18
+    * print out his total and the dealer’s total 
19
+    * check who has won and print it 
20
+    * end the game 
21
+  * If his input was “hit”: 
22
+    * draw him a new card and add it to his total 
23
+    * check if he has bust – if so the game ends and he loses, if not print his new total 
24
+    * if he didn’t bust, decide whether the dealer will draw 
25
+    * check if the dealer is bust – if so the game ends and the player wins 
26
+
27
+That’s all!
28
+
29
+you might want to use...
30
+
31
+```
32
+public int generateRandomInt() {
33
+    int min = 1;
34
+    int max = 10;
35
+    Random r = new Random();
36
+    return r.nextInt((max - min) + 1) + min;
37
+    }
38
+```
39
+
40
+You will have to put
41
+`import java.util.Random;` at the very top of your class file.