View difference between Paste ID: 5XM1hPp7 and 8a8j9FpC
SHOW: | | - or go back to the newest paste.
1
import java.util.*;
2
3
class SkyrimAlchemy {
4
	private String[][] ingredients = new String [][] {
5
		new String[] {"Abecean Longfin", "Weakness to Frost", "Fortify Sneak", "Weakness to Poison", "Fortify Restoration"},
6
		new String[] {"Ash Creep Cluster (DB)", "Damage Stamina", "Invisibility", "Resist Fire", "Fortify Destruction"},
7
		new String[] {"Ash Hopper Jelly (DB)", "Restore Health", "Fortify Light Armor", "Resist Shock", "Weakness to Frost"},
8
		new String[] {"Ashen Grass Pod (DB)", "Resist Fire", "Weakness to Shock", "Fortify Lockpicking", "Fortify Sneak"},
9
		new String[] {"Ancestor Moth Wing (DG)", "Damage Stamina", "Fortify Conjuration", "Damage Magicka Regen", "Fortify Enchanting"},
10
		new String[] {"Bear Claws", "Restore Stamina", "Fortify Health", "Fortify One-Handed", "Damage Magicka Regen"},
11
		new String[] {"Bee", "Restore Stamina", "Ravage Stamina", "Regenerate Stamina", "Weakness to Shock"},
12
		new String[] {"Beehive Husk", "Resist Poison", "Fortify Light Armor", "Fortify Sneak", "Fortify Destruction"},
13
		new String[] {"Bleeding Crown", "Weakness to Fire", "Fortify Block", "Weakness to Poison", "Resist Magic"},
14
		new String[] {"Blisterwort", "Damage Stamina", "Frenzy", "Restore Health", "Fortify Smithing"},
15
		new String[] {"Blue Butterfly Wing", "Damage Stamina", "Fortify Conjuration", "Damage Magicka Regen", "Fortify Enchanting"},
16
		new String[] {"Blue Dartwing", "Resist Shock", "Fortify Pickpocket", "Restore Health", "Fear"},
17
		new String[] {"Blue Mountain Flower", "Restore Health", "Fortify Health", "Fortify Conjuration", "Damage Magicka Regen"},
18
		new String[] {"Boar Tusk (DB)", "Fortify Stamina", "Fortify Health", "Fortify Block", "Frenzy"},
19
		new String[] {"Bone Meal", "Damage Stamina", "Resist Fire", "Fortify Conjuration", "Ravage Stamina"},
20
		new String[] {"Briar Heart", "Restore Magicka", "Fortify Block", "Paralysis", "Fortify Magicka"},
21
		new String[] {"Burnt Spriggan Wood (DB)", "Weakness to Fire", "Fortify Alteration", "Damage Magicka Regen", "Slow"},
22
		new String[] {"Butterfly Wing", "Restore Health", "Fortify Barter", "Lingering Damage Stamina", "Damage Magicka"},
23
		new String[] {"Canis Root", "Damage Stamina", "Fortify One-Handed", "Fortify Marksman", "Paralysis"},
24
		new String[] {"Charred Skeever Hide", "Restore Stamina", "Cure Disease", "Resist Poison", "Restore Health"},
25
		new String[] {"Chaurus Eggs", "Weakness to Poison", "Fortify Stamina", "Damage Magicka", "Invisibility"},
26
		new String[] {"Chaurus Hunter Antennae (DG)", "Damage Stamina", "Fortify Conjuration", "Damage Magicka Regen", "Fortify Enchanting"},
27
		new String[] {"Chicken's Egg", "Resist Magic", "Damage Magicka Regen", "Waterbreathing", "Lingering Damage Stamina"},
28
		new String[] {"Creep Cluster", "Restore Magicka", "Damage Stamina Regen", "Fortify Carry Weight", "Weakness to Magic"},
29
		new String[] {"Crimson Nirnroot", "Damage Health", "Damage Stamina", "Invisibility", "Resist Magic"},
30
		new String[] {"Cyrodilic Spadetail", "Damage Stamina", "Fortify Restoration", "Fear", "Ravage Health"},
31
		new String[] {"Daedra Heart", "Damage Stamina Regen", "Restore Health", "Damage Magicka", "Fear"},
32
		new String[] {"Deathbell", "Damage Health", "Ravage Stamina", "Slow", "Weakness to Poison"},
33
		new String[] {"Dragon's Tongue", "Resist Fire", "Fortify Barter", "Fortify Illusion", "Fortify Two-handed"},
34
		new String[] {"Dwarven Oil", "Weakness to Magic", "Fortify Illusion", "Regenerate Magicka", "Restore Magicka"},
35
		new String[] {"Ectoplasm", "Restore Magicka", "Fortify Destruction", "Fortify Magicka", "Damage Health"},
36
		new String[] {"Elves Ear", "Restore Magicka", "Fortify Marksman", "Weakness to Frost", "Resist Fire"},
37
		new String[] {"Emperor Parasol Mossv", "Damage Health", "Fortify Magicka", "Regenerate Health", "Fortify Two-Handed"},
38
		new String[] {"Eye of Sabre Cat", "Restore Stamina", "Ravage Health", "Damage Magicka", "Restore Health"},
39
		new String[] {"Falmer Ear", "Damage Health", "Resist Poison", "Frenzy", "Fortify Lockpicking"},
40
		new String[] {"Felsaad Tern Feathers (DB)", "Restore Health", "Fortify Light Armor", "Cure Disease", "Resist Magic"},
41
		new String[] {"Fire Salts", "Weakness to Frost", "Restore Magicka", "Resist Fire", "Regenerate Magicka"},
42
		new String[] {"Fly Amanita", "Resist Fire", "Fortify Two-handed", "Frenzy", "Regenerate Stamina"},
43
		new String[] {"Frost Mirriam", "Resist Frost", "Fortify Sneak", "Ravage Magicka", "Damage Stamina Regen"},
44
		new String[] {"Frost Salts", "Weakness to Fire", "Resist Frost", "Restore Magicka", "Fortify Conjuration"},
45
		new String[] {"Garlic", "Resist Poison", "Fortify Stamina", "Regenerate Magicka", "Regenerate Health"},
46
		new String[] {"Giant Lichen", "Ravage Health", "Weakness to Shock", "Weakness to Poison", "Restore Magicka"},
47
		new String[] {"Giant's Toe", "Damage Stamina", "Fortify Health", "Fortify Carry Weight", "Damage Stamina Regen"},
48
		new String[] {"Gleamblossom (DG)", "Resist Magic", "Fear", "Regenerate Health", "Paralysis"},
49
		new String[] {"Glow Dust", "Damage Magicka", "Damage Magicka Regen", "Fortify Destruction", "Resist Shock"},
50
		new String[] {"Glowing Mushroom", "Resist Shock", "Fortify Destruction", "Fortify Smithing", "Fortify Health"},
51
		new String[] {"Grass Pod", "Resist Poison", "Ravage Magicka", "Fortify Alteration", "Restore Magicka"},
52
		new String[] {"Hagraven Claw", "Resist Magic", "Lingering Damage Magicka", "Fortify Enchanting", "Fortify Barter"},
53
		new String[] {"Hagraven Feathers", "Damage Magicka", "Fortify Conjuration", "Frenzy", "Weakness to Shock"},
54
		new String[] {"Hanging Moss", "Damage Magicka", "Fortify Health", "Damage Magicka Regen", "Fortify One-Handed"},
55
		new String[] {"Hawk Beak", "Restore Stamina", "Resist Frost", "Fortify Carry Weight", "Resist Shock"},
56
		new String[] {"Hawk's Egg", "Resist Magic", "Damage Magicka Regen", "Waterbreathing", "Lingering Damage Stamina"},
57
		new String[] {"Hawk Feathers", "Cure Disease", "Fortify Light Armor", "Fortify One-Handed", "Fortify Sneak"},
58
		new String[] {"Histcarp", "Restore Stamina", "Fortify Magicka", "Damage Stamina Regen", "Waterbreathing"},
59
		new String[] {"Honeycomb", "Restore Stamina", "Fortify Block", "Fortify Light Armor", "Ravage Stamina"},
60
		new String[] {"Human Flesh", "Damage Health", "Paralysis", "Restore Magicka", "Fortify Sneak"},
61
		new String[] {"Human Heart", "Damage Health", "Damage Magicka", "Damage Magicka Regen", "Frenzy"},
62
		new String[] {"Ice Wraith Teeth", "Weakness to Frost", "Fortify Heavy Armor", "Invisibility", "Weakness to Fire"},
63
		new String[] {"Imp Stool", "Damage Health", "Lingering Damage Health", "Paralysis", "Restore Health"},
64
		new String[] {"Jarrin Root", "Damage Health", "Damage Magicka", "Damage Stamina", "Damage Magicka Regen"},
65
		new String[] {"Jazbay Grapes", "Weakness to Magic", "Fortify Magicka", "Regenerate Magicka", "Ravage Health"},
66
		new String[] {"Juniper Berries", "Weakness to Fire", "Fortify Marksman", "Regenerate Health", "Damage Stamina Regen"},
67
		new String[] {"Large Antlers", "Restore Stamina", "Fortify Stamina", "Slow", "Damage Stamina Regen"},
68
		new String[] {"Lavender", "Resist Magic", "Fortify Stamina", "Ravage Magicka", "Fortify Conjuration"},
69
		new String[] {"Luna Moth Wing", "Damage Magicka", "Fortify Light Armor", "Regenerate Health", "Invisibility"},
70
		new String[] {"Moon Sugar", "Weakness to Fire", "Resist Frost", "Restore Magicka", "Regenerate Magicka"},
71
		new String[] {"Mora Tapinella", "Restore Magicka", "Lingering Damage Health", "Regenerate Stamina", "Fortify Illusion"},
72
		new String[] {"Mudcrab Chitin", "Restore Stamina", "Cure Disease", "Resist Poison", "Resist Fire"},
73
		new String[] {"Namira's Rot", "Damage Magicka", "Fortify Lockpicking", "Fear", "Regenerate Health"},
74
		new String[] {"Netch Jelly (DB)", "Paralysis", "Fortify Carry Weight", "Restore Stamina", "Fear"},
75
		new String[] {"Nightshade", "Damage Health", "Damage Magicka Regen", "Lingering Damage Stamina", "Fortify Destruction"},
76
		new String[] {"Nirnroot", "Damage Health", "Damage Stamina", "Invisibility", "Resist Magic"},
77
		new String[] {"Nordic Barnacle", "Damage Magicka", "Waterbreathing", "Regenerate Health", "Fortify Pickpocket"},
78
		new String[] {"Orange Dartwing", "Restore Stamina", "Ravage Magicka", "Fortify Pickpocket", "Lingering Damage Health"},
79
		new String[] {"Pearl", "Restore Stamina", "Fortify Block", "Restore Magicka", "Resist Shock"},
80
		new String[] {"Pine Thrush Egg", "Restore Stamina", "Fortify Lockpicking", "Weakness to Poison", "Resist Shock"},
81
		new String[] {"Poison Bloom (DG)", "Damage Health", "Slow", "Fortify Carry Weight", "Fear"},
82
		new String[] {"Powdered Mammoth Tusk", "Restore Stamina", "Fortify Sneak", "Weakness to Fire", "Fear"},
83
		new String[] {"Purple Mountain Flower", "Restore Stamina", "Fortify Sneak", "Lingering Damage Magicka", "Resist Frost"},
84
		new String[] {"Red Mountain Flower", "Restore Magicka", "Ravage Magicka", "Fortify Magicka", "Damage Health"},
85
		new String[] {"River Betty", "Damage Health", "Fortify Alteration", "Slow", "Fortify Carry Weight"},
86
		new String[] {"Rock Warbler Egg", "Restore Health", "Fortify One-Handed", "Damage Stamina", "Weakness to Magic"},
87
		new String[] {"Sabre Cat Tooth", "Restore Stamina", "Fortify Heavy Armor", "Fortify Smithing", "Weakness to Poison"},
88
		new String[] {"Salmon Roe", "Restore Stamina", "Waterbreathing", "Fortify Magicka", "Regenerate Magicka"},
89
		new String[] {"Salt Pile", "Weakness to Magic", "Fortify Restoration", "Slow", "Regenerate Magicka"},
90
		new String[] {"Scaly Pholiata", "Weakness to Magic", "Fortify Illusion", "Regenerate Stamina", "Fortify Carry Weight"},
91
		new String[] {"Scathecraw (DB)", "Ravage Health", "Ravage Stamina", "Ravage Magicka", "Lingering Damage Health"},
92
		new String[] {"Silverside Perch", "Restore Stamina", "Damage Stamina Regen", "Ravage Health", "Resist Frost"},
93
		new String[] {"Skeever Tail", "Damage Stamina Regen", "Ravage Health", "Damage Health", "Fortify Light Armor"},
94
		new String[] {"Slaughterfish Egg", "Resist Poison", "Fortify Pickpocket", "Lingering Damage Health", "Fortify Stamina"},
95
		new String[] {"Slaughterfish Scales", "Resist Frost", "Lingering Damage Health", "Fortify Heavy Armor", "Fortify Block"},
96
		new String[] {"Small Antlers", "Weakness to Poison", "Fortify Restoration", "Lingering Damage Stamina", "Damage Health"},
97
		new String[] {"Small Pearl", "Restore Stamina", "Fortify One-Handed", "Fortify Restoration", "Resist Frost"},
98
		new String[] {"Snowberries", "Resist Fire", "Fortify Enchanting", "Resist Frost", "Resist Shock"},
99
		new String[] {"Spawn Ash (DB)", "Ravage Stamina", "Resist Fire", "Fortify Enchanting", "Ravage Magicka"},
100
		new String[] {"Spider Egg", "Damage Stamina", "Damage Magicka Regen", "Fortify Lockpicking", "Fortify Marksman"},
101
		new String[] {"Spriggan Sap", "Damage Magicka Regen", "Fortify Enchanting", "Fortify Smithing", "Fortify Alteration"},
102
		new String[] {"Swamp Fungal Pod", "Resist Shock", "Lingering Damage Magicka", "Paralysis", "Restore Health"},
103
		new String[] {"Taproot", "Weakness to Magic", "Fortify Illusion", "Regenerate Magicka", "Restore Magicka"},
104
		new String[] {"Thistle Branch", "Resist Frost", "Ravage Stamina", "Resist Poison", "Fortify Heavy Armor"},
105
		new String[] {"Torchbug Thorax", "Restore Stamina", "Lingering Damage Magicka", "Weakness to Magic", "Fortify Stamina"},
106
		new String[] {"Trama Root (DB)", "Weakness to Shock", "Fortify Carry Weight", "Damage Magicka", "Slow"},
107
		new String[] {"Troll Fat", "Resist Poison", "Fortify Two-handed", "Frenzy", "Damage Health"},
108
		new String[] {"Tundra Cotton", "Resist Magic", "Fortify Magicka", "Fortify Block", "Fortify Barter"},
109
		new String[] {"Vampire Dust", "Invisibility", "Restore Magicka", "Regenerate Health", "Cure Disease"},
110
		new String[] {"Void Salts", "Weakness to Shock", "Resist Magic", "Damage Health", "Fortify Magicka"},
111
		new String[] {"Wheat", "Restore Health", "Fortify Health", "Damage Stamina Regen", "Lingering Damage Magicka"},
112
		new String[] {"White Cap", "Weakness to Frost", "Fortify Heavy Armor", "Restore Magicka", "Ravage Magicka"},
113
		new String[] {"Wisp Wrappings", "Restore Stamina", "Fortify Destruction", "Fortify Carry Weight", "Resist Magic"},
114
		new String[] {"Yellow Mountain Flower (DG)", "Resist Poison", "Fortify Restoration", "Fortify Health", "Damage Stamina Regen"},
115
	};
116
	
117
	SkyrimAlchemy () {
118
		String searchMode = "ing";
119
		Scanner scanner = new Scanner (System.in);
120
		System.out.println (" ");
121
		
122
		do {
123
			String input = scanner.nextLine ();
124
			
125
			if (input.matches ("^quit$")) {
126
				scanner = null;
127
				return;
128
			};
129
			
130
			if (input.matches ("^setmode .+")) 
131
				searchMode = input.substring (7).equals ("ing") ? "ing" : "eff";
132
			
133
			else if (searchMode.equals ("ing"))
134
				getCompatableIngredients (input);
135
			else if (searchMode.equals ("eff"))
136
				getCompatableEffects (input);
137
			
138
		} while (scanner != null);
139
	};
140
	
141
	String findRealIngredientName (String input) {
142
		for (String [] array : ingredients)
143
			if (array [0].toLowerCase ().equals (input.toLowerCase ()))//.substring (0, input.length () - 1) == input.toLowerCase ())
144
				return array [0];
145
		
146
		return "not found";
147
	};
148
	String findRealEffect (String input) {
149
		for (String [] array : ingredients)
150
			for (int i = 1; i < array.length; i++)
151
				if (array [i].toLowerCase ().equals (input.toLowerCase ()))//.substring (0, input.length () - 1) == input.toLowerCase ())
152
					return array [i];
153
		
154
		return "not found";
155
	};
156
	String [] getIngredientEffects (String input) {
157
		input = findRealIngredientName (input);
158
		if (input.equals ("not found"))
159
			return new String [] {"Not found", "Not found", "Not found", "Not found"};
160
		
161
		for (String[] s: ingredients) 
162
			if (s [0].equals (input))
163
				return new String []{s [1], s [2], s [3], s [4]};
164
			
165
		return new String [] {"Not found", "Not found", "Not found", "Not found"};
166
	};
167
168
	void getCompatableIngredients (String input) {
169
		input = findRealIngredientName (input);
170
		
171
		if (input.equals ("not found")) {
172
			print ("Ingredient not found.");
173
			return ;
174
		};
175
		
176
		String [] ingredientEffects = getIngredientEffects (input);
177
		HashMap <String, Boolean> compatableIngredients = new
178
			HashMap <>();
179
		
180
		print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
181
		print (input); //simulate normality of terminal?
182
		print ("Finding compatable ingredients for " + input);
183
		print (String.format ("Ingredients: %s, %s, %s, %s", ingredientEffects [0], ingredientEffects [1], ingredientEffects [2], ingredientEffects [3]));
184
		
185
		for (String arr[]: ingredients) 
186
			for (int i = 1; i < arr.length; ++i) 
187
				for (int j = 0; j < ingredientEffects.length; ++j) 
188
					if (arr [i].equals (ingredientEffects [j])) 
189
						if (compatableIngredients.get (arr [0]) == null) 
190
							compatableIngredients.put (arr [0], Boolean.TRUE);
191
						
192
		Object []objs = compatableIngredients.keySet ().toArray ();
193
		
194
		if (objs.length == 0)
195
			print ("None found");
196
		else
197
			for (Object key:objs)
198
				print (key.toString ());
199
	};
200
	
201
	void getCompatableEffects (String effect) { 
202
		String input = findRealEffect (effect);
203
		
204
		if (input.equals ("not found")) {
205
			print ("Effect not found.");
206
			return ;
207
		};
208
		
209
		String [] ingredientEffects = getIngredientEffects (input);
210
		HashMap <String, Boolean> compatableIngredients = new
211
			HashMap <>();
212
		
213
		print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
214
		print (input); //simulate normality of terminal?
215
		print ("Finding compatable effects for " + input);
216
		
217
		for (String arr[]: ingredients) 
218
			for (int i = 1; i < arr.length; ++i) 
219
				for (int j = 0; j < ingredientEffects.length; ++j) 
220
					if (arr [i].toLowerCase ().equals (input.toLowerCase ())) 
221
						if (compatableIngredients.get (arr [0]) == null) 
222
							compatableIngredients.put (arr [0], Boolean.TRUE);
223
						
224
		Object []objs = compatableIngredients.keySet ().toArray ();
225
		
226
		if (objs.length == 0)
227
			print ("None found");
228
		else
229
			for (Object key:objs)
230
				print (key.toString ());
231
	};
232
	
233
	void print (String s) {
234
		System.out.println (s);
235
	};
236
	
237
	void print (String [] s) {
238
		String raw = "";
239
		for (String str : s)
240
			raw += raw.length() == 0 ? "" : "\t" + str;
241
		
242
		print (raw);
243
	};
244
	
245
	static void main (String []args) {
246
		new SkyrimAlchemy ();
247
	};
248
};