Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package notDefault;
- public class Main {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int typeCount = 18;
- Type[] types = new Type[typeCount];
- types[0] = new Type("Rock", 1, 2, 1, 2, 0.5, 1, 0.5, 2, 0.5, 1, 0.5, 1, 2, 2, 1, 1, 1, 1);
- types[1] = new Type("Water", 1, 0.5, 2, 2, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 0.5, 0.5, 1, 1, 1);
- types[2] = new Type("Electric", 1, 1, 0.5, 1, 1, 1, 1, 2, 0.5, 1, 1, 1, 1, 0.5, 1, 1, 1, 1);
- types[3] = new Type("Grass", 1, 0.5, 0.5, 0.5, 2, 1, 2, 0.5, 2, 2, 1, 1, 1, 1, 2, 1, 1, 1);
- types[4] = new Type("Poison", 1, 1, 1, 0.5, 0.5, 2, 1, 2, 1, 0.5, 1, 1, 0.5, 1, 1, 1, 1, 0.5);
- types[5] = new Type("Psychic", 1, 1, 1, 1, 1, 0.5, 1, 1, 1, 2, 1, 2, 0.5, 1, 1, 1, 2, 1);
- types[6] = new Type("Fire", 2, 2, 1, 0.5, 1, 1, 0.5, 2, 1, 0.5, 1, 1, 1, 0.5, 0.5, 1, 1, 0.5);
- types[7] = new Type("Ground", 0.5, 2, 0, 2, 0.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1);
- types[8] = new Type("Flying", 2, 1, 2, 0.5, 1, 1, 1, 0, 1, 0.5, 1, 1, 0.5, 1, 2, 1, 1, 1);
- types[9] = new Type("Bug", 2, 1, 1, 0.5, 1, 1, 2, 0.5, 2, 1, 1, 1, 0.5, 1, 1, 1, 1, 1);
- types[10] = new Type("Normal", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1);
- types[11] = new Type("Ghost", 1, 1, 1, 1, 0.5, 1, 1, 1, 1, 0.5, 0, 2, 0, 1, 1, 1, 2, 1);
- types[12] = new Type("Fighting", 0.5, 1, 1, 1, 1, 2, 1, 1, 2, 0.5, 1, 1, 1, 1, 1, 1, 0.5, 2);
- types[13] = new Type("Steel", 0.5, 1, 1, 0.5, 0, 0.5, 2, 2, 0.5, 0.5, 0.5, 1, 2, 0.5, 0.5, 0.5, 1, 0.5);
- types[14] = new Type("Ice", 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, 0.5, 1, 1, 1);
- types[15] = new Type("Dragon", 1, 0.5, 0.5, 0.5, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2);
- types[16] = new Type("Dark", 1, 1, 1, 1, 1, 0, 1, 1, 1, 2, 1, 0.5, 2, 1, 1, 1, 0.5, 2);
- types[17] = new Type("Fairy", 1, 1, 1, 1, 2, 1, 1, 1, 1, 0.5, 1, 1, 0.5, 2, 1, 0, 0.5, 1);
- for(int i = 1; i <= typeCount; i ++){
- Type[] combo = new Type[i];
- search(combo, types, 0, 0, typeCount);
- }
- }
- public static void search(Type[] combo, Type[] types, int currentComboIndex, int currentTypeIndex,
- int typeCount){
- //System.out.println("first print " + currentComboIndex);
- for(int i = currentTypeIndex; i < typeCount; i ++){
- //System.out.println(currentComboIndex + " " + i);
- //System.out.println("second print " + currentComboIndex);
- combo[currentComboIndex] = types[i];
- //System.out.println(currentComboIndex + " " + combo.length);
- if(currentComboIndex + 1 < combo.length){
- //System.out.println(i);
- search(combo, types, currentComboIndex + 1, i + 1, typeCount);
- }
- else{
- boolean noWeakness = true;
- for(int j = 0; j < typeCount; j ++){
- double effect = 1;
- for(int k = 0; k < combo.length; k ++){
- effect *= combo[k].effects[j];
- }
- if(effect > 1){
- noWeakness = false;
- }
- }
- if(noWeakness){
- for(int k = 0; k < combo.length; k ++){
- System.out.print(combo[k].name + " ");
- }
- System.out.print("\n");
- }
- }
- }
- }
- }
- package notDefault;
- public class Type {
- public String name;
- public double[] effects = new double[18];
- public Type(String inString, double arg0, double arg1, double arg2, double arg3, double arg4, double arg5,
- double arg6, double arg7, double arg8, double arg9, double arg10, double arg11, double arg12, double arg13,
- double arg14, double arg15, double arg16, double arg17){
- name = inString;
- effects[0] = arg0;
- effects[1] = arg1;
- effects[2] = arg2;
- effects[3] = arg3;
- effects[4] = arg4;
- effects[5] = arg5;
- effects[6] = arg6;
- effects[7] = arg7;
- effects[8] = arg8;
- effects[9] = arg9;
- effects[10] = arg10;
- effects[11] = arg11;
- effects[12] = arg12;
- effects[13] = arg13;
- effects[14] = arg14;
- effects[15] = arg15;
- effects[16] = arg16;
- effects[17] = arg17;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement