-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEntryPointCombinations.java
More file actions
104 lines (92 loc) · 4.44 KB
/
Copy pathEntryPointCombinations.java
File metadata and controls
104 lines (92 loc) · 4.44 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/**
* Program that calculates and outputs the total number of possible combinations of daily challenges.
* The output is produced in the console.
*/
import java.io.*;
import java.util.*;
public class EntryPointCombinations {
final static String TXT_FILE_NAME = "EP Probabilities Raw.txt"; //change depending on the name you set for the output of EntryPointProbabilities.java
/** The missions that can have daily challenges, in all caps and without "The" at the beginning.
* I could've split this enum into one for stealth missions and one for loud missions, but that would require more typing. */
private enum Mission {
BLACKSITE, FINANCIER, DEPOSIT, LAKEHOUSE, WITHDRAWAL, SCIENTIST, SCRS, BLACK_DUSK,
KILLHOUSE, AUCTION, GALA, CACHE, SETUP, LOCKUP, SCORE
}
final static Mission[] STEALTH_MISSIONS = {
Mission.BLACKSITE, Mission.FINANCIER, Mission.DEPOSIT, Mission.LAKEHOUSE, Mission.WITHDRAWAL, Mission.SCIENTIST,
Mission.SCRS, Mission.KILLHOUSE, Mission.AUCTION, Mission.GALA, Mission.CACHE, Mission.SETUP, Mission.LOCKUP
};
final static Mission[] LOUD_MISSIONS = {
Mission.BLACKSITE, Mission.FINANCIER, Mission.DEPOSIT, Mission.LAKEHOUSE, Mission.WITHDRAWAL, Mission.SCIENTIST,
Mission.SCRS, Mission.BLACK_DUSK, Mission.KILLHOUSE, Mission.LOCKUP, Mission.SCORE
};
/** @return The Class object representing Mission. */
@SuppressWarnings("unchecked")
private static Class<Mission> getMissionClass() {
return (Class<Mission>)Mission.SCRS.getClass(); //could be any mission here
}
public static void main(String[] args) {
try (BufferedReader readFile = new BufferedReader(new FileReader(TXT_FILE_NAME));) {
Map<Mission, Short> stealthNumModifiers = new EnumMap<>(getMissionClass());
Map<Mission, Short> loudNumModifiers = new EnumMap<>(getMissionClass());
Map<Mission, Short> stealthNumCombos = new EnumMap<>(getMissionClass());
Map<Mission, Short> loudNumCombos = new EnumMap<>(getMissionClass());
//highest num combo value is 2,925 which is below the max value for shorts (32,767)
Mission mission;
String line = readFile.readLine(); //first line of the txt file is not needed
boolean isStealth = true;
int totalStealth = 0, totalLoud = 0;
for (Mission m : STEALTH_MISSIONS) {
stealthNumModifiers.put(m, (short)0);
}
for (Mission m : LOUD_MISSIONS) {
loudNumModifiers.put(m, (short)0);
}
//processes the txt file
while (true) {
line = readFile.readLine().trim();
if (line.contains("was")) {break;} //the last part of the txt file is not needed
if (line.equals("Loud:")) {
isStealth = false;
continue;
}
if (line.endsWith("0.0") || !line.contains(".")) {continue;}
mission = Mission.valueOf(line.substring(0, line.indexOf(':')));
if (isStealth) {
stealthNumModifiers.put(mission, (short)(stealthNumModifiers.get(mission) + 1));
} else { //is loud
loudNumModifiers.put(mission, (short)(loudNumModifiers.get(mission) + 1));
}
}
//calculate raw num combos for each mission
for (Mission m : STEALTH_MISSIONS) {
stealthNumCombos.put(m, (short)(stealthNumModifiers.get(m) * (stealthNumModifiers.get(m) - 1) * (stealthNumModifiers.get(m) - 2) / 6));
}
for (Mission m : LOUD_MISSIONS) {
loudNumCombos.put(m, (short)(loudNumModifiers.get(m) * (loudNumModifiers.get(m) - 1) * (loudNumModifiers.get(m) - 2) / 6));
}
//remove No Knockouts & No Suppressors combos
stealthNumCombos.put(Mission.SCIENTIST, (short)(stealthNumCombos.get(Mission.SCIENTIST) - stealthNumModifiers.get(Mission.SCIENTIST) + 2));
//displays the number of combinations
System.out.println("Stealth:");
for (Mission m : STEALTH_MISSIONS) {
totalStealth += stealthNumCombos.get(m);
System.out.println(m.toString() + ": " + stealthNumCombos.get(m));
}
System.out.println("Total stealth: " + totalStealth);
System.out.println("\nLoud:");
for (Mission m : LOUD_MISSIONS) {
totalLoud += loudNumCombos.get(m);
System.out.println(m.toString() + ": " + loudNumCombos.get(m));
}
System.out.println("Total loud: " + totalLoud);
System.out.println("\nGrand total: " + (totalStealth + totalLoud));
} catch (FileNotFoundException e) {
System.out.println("The txt file does not exist or could not be found.");
System.err.println("FileNotFoundException: " + e.getMessage());
} catch (IOException e) {
System.out.println("The txt file could not be read or closed.");
System.err.println("IOException: " + e.getMessage());
}
}
}