Finished up complexer picker, it has some bugs, so im making a better verbose system
This commit is contained in:
@@ -3,19 +3,59 @@ package me.trouper.Functions;
|
||||
import me.trouper.Main;
|
||||
import me.trouper.Utils.Utils;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
|
||||
import static me.trouper.Functions.Eval.eval;
|
||||
import static me.trouper.Functions.Eval.isPerfectSquare;
|
||||
|
||||
public class Complexers {
|
||||
/* Complexer Toggles */
|
||||
public static boolean divide;
|
||||
public static boolean power;
|
||||
public static boolean root;
|
||||
public static boolean mrDividend;
|
||||
public static boolean mrDivisor;
|
||||
public static boolean useDivide;
|
||||
public static boolean usePower;
|
||||
public static boolean useRoot;
|
||||
public static boolean useRDividend;
|
||||
public static boolean useRDivisor;
|
||||
|
||||
public static String pickComplexer() {
|
||||
List<String> enabledComplexers = new ArrayList<>();
|
||||
|
||||
if (useDivide) enabledComplexers.add("divide");
|
||||
if (usePower) enabledComplexers.add("power");
|
||||
if (useRoot) enabledComplexers.add("root");
|
||||
if (useRDividend) enabledComplexers.add("mrDividend");
|
||||
if (useRDivisor) enabledComplexers.add("mrDivisor");
|
||||
|
||||
Collections.shuffle(enabledComplexers);
|
||||
if (!enabledComplexers.isEmpty()) {
|
||||
return enabledComplexers.get(0);
|
||||
} else {
|
||||
return "NONE";
|
||||
}
|
||||
}
|
||||
public static String complex(int i, boolean deep) {
|
||||
String complexer = pickComplexer();
|
||||
if (isPerfectSquare(i)) complexer = "power";
|
||||
switch (complexer) {
|
||||
case "divide" -> {
|
||||
return divide(i,deep);
|
||||
}
|
||||
case "power" -> {
|
||||
return power(i,deep);
|
||||
}
|
||||
case "root" -> {
|
||||
return root(i,deep);
|
||||
}
|
||||
case "mrDividend" -> {
|
||||
return mRootDividend(i,deep);
|
||||
}
|
||||
case "mrDivisor" -> {
|
||||
return mRootDivisor(i,deep);
|
||||
}
|
||||
default -> {
|
||||
return divide(i,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Safe to use with D mode
|
||||
* @param i Integer to divide
|
||||
@@ -30,13 +70,10 @@ public class Complexers {
|
||||
boolean expFac = false;
|
||||
boolean expDoub = false;
|
||||
|
||||
if (isPerfectSquare(factor)) expFac = true;
|
||||
if (isPerfectSquare(doubled)) expDoub = true;
|
||||
|
||||
String result = "<&f>(<&r><&e>" + doubled + "<&b>/<&r><&e>" + factor + "<&f>)<&r>";
|
||||
|
||||
if (deep) {
|
||||
result = "<&3>(<&r><&d>" + ((expDoub) ? power(doubled,false) : divide(doubled,false)) + "<&b>/<&r><&d>" + ((expFac) ? power(factor,false) : divide(factor,false)) + "<&3>)<&r>";
|
||||
result = "<&3>(<&r><&d>" + (complex(doubled,false)) + "<&b>/<&r><&d>" + (complex(factor,false)) + "<&3>)<&r>";
|
||||
}
|
||||
if (eval(result) != i) Utils.verbose("Failed to divide " + i + ", Attempted: " + result + "=" + eval(result));
|
||||
return eval(result) == i ? result : "(" + i + ")";
|
||||
@@ -58,7 +95,7 @@ public class Complexers {
|
||||
String result = "<&r><&f>(<&e>" + root + "<&b>^<&e>2<&f>)<&r>";
|
||||
|
||||
if (deep) {
|
||||
result = "<&r><&3>(<&d>" + divide(root,false) + "<&b>^<&d>2<&3>)<&r>";
|
||||
result = "<&r><&3>(<&d>" + complex(root,false) + "<&b>^<&d>2<&3>)<&r>";
|
||||
}
|
||||
if (eval(result) != i) Utils.verbose("<&ch>Failed to power <&r>" + i + ", Attempted: " + result + "=" + eval(result));
|
||||
return eval(result) == i ? result : "(" + i + ")";
|
||||
@@ -75,7 +112,7 @@ public class Complexers {
|
||||
String result = "<&9>sqrt<&r><&f>(<&r><&e>" + squared + "<&f>)<&r>";
|
||||
|
||||
if (deep) {
|
||||
result = "<&1>sqrt<&r><&3>(<&r><&d>" + divide(squared,false) + "<&3>)<&r>";
|
||||
result = "<&1>sqrt<&r><&3>(<&r><&d>" + complex(squared, false) + "<&3>)<&r>";
|
||||
}
|
||||
if (eval(result) != i) Utils.verbose("<&ch>Failed to root <&r>" + i + ", Attempted: " + result + "=" + eval(result));
|
||||
return (eval(result) == i) ? result : "(" + i + ")";
|
||||
@@ -93,7 +130,7 @@ public class Complexers {
|
||||
int divisor = Utils.moduRootDivisor(dividend,i);
|
||||
String result = "<&r><&f>(<&e>" + dividend + "<&b>%<&e>" + divisor + "<&f>)<&r>";
|
||||
if (deep) {
|
||||
result = "<&r><&f>(<&e>" + dividend + "<&b>%<&e>" + divisor + "<&f>)<&r>";
|
||||
result = "<&r><&7>(<&d>" + complex(dividend,false) + "<&b>%<&d>" + complex(divisor, false) + "<&7>)<&r>";
|
||||
}
|
||||
Utils.verbose("<&dh><&b>mRootDivisor has ran!<&r>" +
|
||||
"\nWanted: " + i +
|
||||
@@ -116,6 +153,9 @@ public class Complexers {
|
||||
int divisor = random.nextInt(9)+i+10;
|
||||
int dividend = Utils.moduRootDividend(divisor,i);
|
||||
String result = "<&r><&f>(<&e>" + dividend + "<&b>%<&e>" + divisor + "<&f>)<&r>";
|
||||
if (deep) {
|
||||
result = "<&r><&7>(<&d>" + complex(dividend,false) + "<&b>%<&d>" + complex(divisor,false) + "<&7>)<&r>";
|
||||
}
|
||||
Utils.verbose("<&dh><&b>mRootDividend has been ran!<&r>" +
|
||||
"\nWanted:" + i +
|
||||
"\nDivisor: " + divisor +
|
||||
|
||||
@@ -53,7 +53,7 @@ public class Obf {
|
||||
eval = (int) eval(expression.toString());
|
||||
}
|
||||
|
||||
final String toAdd = complex(ri,deep,"n");
|
||||
final String toAdd = Complexers.complex(ri,deep);
|
||||
|
||||
if (eval < target) {
|
||||
if (target - eval > 4069) {
|
||||
@@ -110,7 +110,7 @@ public class Obf {
|
||||
int ri = random.nextInt(9)+1;
|
||||
|
||||
|
||||
final String toAdd = complex(ri,deep,"d");
|
||||
final String toAdd = Complexers.complex(ri,deep);
|
||||
|
||||
if (eval < target) {
|
||||
if (target - eval > 4096) {
|
||||
@@ -144,35 +144,4 @@ public class Obf {
|
||||
}
|
||||
return expression.toString();
|
||||
}
|
||||
public static String increase(int target, int current, boolean deep, String mode) {
|
||||
return target + "" + current;
|
||||
}
|
||||
public static String complex(int target, boolean deep, String mode) {
|
||||
Random random = new Random();
|
||||
String toAdd = "(" + target + ")";
|
||||
int rComplexer;
|
||||
switch (mode) {
|
||||
case "n" -> rComplexer = random.nextInt(4)+1;
|
||||
case "d" -> rComplexer = random.nextInt(3)+1;
|
||||
default -> rComplexer = 1;
|
||||
}
|
||||
if (target == 1) {
|
||||
toAdd = Complexers.power(target,deep);
|
||||
} else if (isPerfectSquare(target)) {
|
||||
toAdd = Complexers.power(target,deep);
|
||||
} else {
|
||||
switch (rComplexer) {
|
||||
case 1 -> toAdd = Complexers.divide(target,deep);
|
||||
case 2 -> toAdd = Complexers.mRootDivisor(target,deep);
|
||||
case 3 -> toAdd = Complexers.mRootDividend(target,deep);
|
||||
case 4 -> toAdd = Complexers.root(target,deep); // Won't reach this one, if its "d" due to it stopping at 3
|
||||
}
|
||||
}
|
||||
|
||||
return (eval(toAdd) == target) ? toAdd : "(" + target + ")";
|
||||
}
|
||||
|
||||
public static String pickComplexer() {
|
||||
return "e";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,12 +47,6 @@ public class Main {
|
||||
boolean doCopy = false;
|
||||
String mode = "N";
|
||||
|
||||
Complexers.divide = true;
|
||||
Complexers.power = true;
|
||||
Complexers.root = true;
|
||||
Complexers.mrDividend = true;
|
||||
Complexers.mrDivisor = true;
|
||||
|
||||
for (String arg : args) {
|
||||
switch (arg) {
|
||||
case "--copy", "-c" -> doCopy = true;
|
||||
@@ -67,6 +61,12 @@ public class Main {
|
||||
}
|
||||
|
||||
|
||||
Complexers.useRoot = !mode.equals("D");
|
||||
Complexers.usePower = true;
|
||||
Complexers.useDivide = true;
|
||||
Complexers.useRDivisor = true;
|
||||
Complexers.useRDividend = true;
|
||||
|
||||
|
||||
if (mode.equals("TEST")) {
|
||||
while (true) {
|
||||
|
||||
7
src/main/java/me/trouper/Utils/Verbose.java
Normal file
7
src/main/java/me/trouper/Utils/Verbose.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package me.trouper.Utils;
|
||||
|
||||
public class Verbose {
|
||||
public static void send(String message, String klass, String type) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user