-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
28 lines (24 loc) · 943 Bytes
/
Main.java
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
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Random;
import java.util.Scanner;
public class Main {
public static Random rnd;
public static void main(String[] args) throws FileNotFoundException {
String filePath = args[0];
File file = new File(filePath);
Scanner scanner = new Scanner(file);
int numberOfGames = scanner.nextInt();
for (int i = 0; i < numberOfGames; i++) {
int seed = scanner.nextInt();
rnd = new Random(seed);
scanner.nextLine();
String player1 = scanner.nextLine();
String player2 = scanner.nextLine();
WarGame game = new WarGame(player1, player2);
String winner = game.start();
System.out.println("+++++++++++++++++++++++++++++++++++++++");
System.out.println(winner + " won the game!\n\n");
}
}
}