-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDriver.java
More file actions
54 lines (35 loc) · 1.08 KB
/
Copy pathDriver.java
File metadata and controls
54 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import java.util.Scanner;
//author alex torres
//this class will test run the game
public class Driver {
public static void main(String[] args) {
Game game = new Game();
//game intro
System.out.println("welcome to the joker game. ");
//starting game
game.gameSetup();
//removing pairs
System.out.println("cards are dealt and all the pairs are being removed");
game.checkingForPairs();
//scanner to get int
Scanner cin = new Scanner(System.in);
//bool to check if game is don
Boolean gameDone= false;
//while loop that keeps game running
while(!gameDone) {
int tempIndex;
System.out.println("Enter an number between 0 and " + (game.getC1Size()-1) + ": ");
tempIndex = cin.nextInt();
//input validation
while (tempIndex > game.getC1Size()) {
System.out.println("please reenter a number between 0 and " + (game.getC1Size()-1));
tempIndex = cin.nextInt();
}
game.setPlayerChoosenIndex(tempIndex);
game.playerTurn();
game.computerTurn();
gameDone = game.isGameDone();
}
cin.close();
}
}