Added Colors + worked on deep
This commit is contained in:
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
21
src/main/java/me/trouper/Data/ANSI.java
Normal file
21
src/main/java/me/trouper/Data/ANSI.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package me.trouper.Data;
|
||||
|
||||
public class ANSI {
|
||||
public static final String RESET = "\u001B[0m";
|
||||
public static final String BLACK = "\u001B[30m";
|
||||
public static final String RED = "\u001B[31m";
|
||||
public static final String GREEN = "\u001B[32m";
|
||||
public static final String YELLOW = "\u001B[33m";
|
||||
public static final String BLUE = "\u001B[34m";
|
||||
public static final String PURPLE = "\u001B[35m";
|
||||
public static final String CYAN = "\u001B[36m";
|
||||
public static final String WHITE = "\u001B[37m";
|
||||
public static final String BLACK_BACKGROUND = "\u001B[40m";
|
||||
public static final String RED_BACKGROUND = "\u001B[41m";
|
||||
public static final String GREEN_BACKGROUND = "\u001B[42m";
|
||||
public static final String YELLOW_BACKGROUND = "\u001B[43m";
|
||||
public static final String BLUE_BACKGROUND = "\u001B[44m";
|
||||
public static final String PURPLE_BACKGROUND = "\u001B[45m";
|
||||
public static final String CYAN_BACKGROUND = "\u001B[46m";
|
||||
public static final String WHITE_BACKGROUND = "\u001B[47m";
|
||||
}
|
||||
@@ -5,36 +5,30 @@ import java.util.Random;
|
||||
import static me.trouper.Functions.Eval.eval;
|
||||
|
||||
public class Complexers {
|
||||
public static String divide(int i) {
|
||||
public static String divide(int i, boolean deep) {
|
||||
Random random = new Random();
|
||||
int factor = random.nextInt(9)+1;
|
||||
int doubled = i * factor;
|
||||
String result = "(" + doubled + "/" + factor + ")";
|
||||
|
||||
String result;
|
||||
if (deep) {
|
||||
result = "(" + Increasers.multiply(doubled,1,false) + "/" + Increasers.multiply(factor,1,false) + ")";
|
||||
} else {
|
||||
result = "(" + doubled + "/" + factor + ")";
|
||||
}
|
||||
if (eval(result) == i) {
|
||||
return result;
|
||||
}
|
||||
return "(" + i + ")";
|
||||
}
|
||||
|
||||
public static String multiply(int i, int factor) {
|
||||
String result = "(" + i + "*" + factor + ")";
|
||||
if (eval(result) == i * factor) {
|
||||
return result;
|
||||
}
|
||||
return "(" + i + ")";
|
||||
}
|
||||
public static String power(int i, int exp) {
|
||||
String result = "(" + i + "^" + exp + ")";
|
||||
if (eval(result) == Math.pow(i,exp)) {
|
||||
return result;
|
||||
}
|
||||
return "(" + i + ")";
|
||||
}
|
||||
|
||||
public static String root(int i) {
|
||||
public static String root(int i, boolean deep) {
|
||||
int squared = (int) Math.pow(i,2);
|
||||
String result = "sqrt(" + squared + ")";
|
||||
String result;
|
||||
if (deep) {
|
||||
result = "sqrt(" + Increasers.power(i,1,false) + ")";
|
||||
} else {
|
||||
result = "sqrt(" + squared + ")";
|
||||
}
|
||||
if (eval(result) == i){
|
||||
return result;
|
||||
}
|
||||
|
||||
30
src/main/java/me/trouper/Functions/Increasers.java
Normal file
30
src/main/java/me/trouper/Functions/Increasers.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package me.trouper.Functions;
|
||||
|
||||
import static me.trouper.Functions.Eval.eval;
|
||||
|
||||
public class Increasers {
|
||||
public static String multiply(int i, int factor, boolean deep) {
|
||||
String result;
|
||||
if (deep) {
|
||||
result = "(" + Complexers.divide(i,false) + "/" + Complexers.divide(factor,false) + ")";
|
||||
} else {
|
||||
result = "(" + i + "*" + factor + ")";
|
||||
}
|
||||
if (eval(result) == i * factor) {
|
||||
return result;
|
||||
}
|
||||
return "(" + i + ")";
|
||||
}
|
||||
public static String power(int i, int exp, boolean deep) {
|
||||
String result;
|
||||
if (deep) {
|
||||
result = "(" + Complexers.root(i,false) + "^" + Complexers.root(exp,false) + ")";
|
||||
} else {
|
||||
result = "(" + i + "^" + exp + ")";
|
||||
}
|
||||
if (eval(result) == Math.pow(i,exp)) {
|
||||
return result;
|
||||
}
|
||||
return "(" + i + ")";
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package me.trouper;
|
||||
|
||||
import me.trouper.Data.ANSI;
|
||||
import me.trouper.Functions.Complexers;
|
||||
import me.trouper.Functions.Increasers;
|
||||
import me.trouper.Functions.Utils;
|
||||
|
||||
import java.util.Random;
|
||||
@@ -12,6 +14,7 @@ import static me.trouper.Functions.Utils.verbose;
|
||||
public class Main {
|
||||
public static boolean verbose;
|
||||
public static boolean deep;
|
||||
private static final StringBuilder formattedExp = new StringBuilder();
|
||||
public static void main(String[] args) {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
boolean doCopy = false;
|
||||
@@ -34,10 +37,10 @@ public class Main {
|
||||
|
||||
System.out.println("\nTarget Integer: " + target);
|
||||
if (output == target) {
|
||||
System.out.println("Expression Verified Correct: \n" + expression);
|
||||
System.out.println(ANSI.GREEN_BACKGROUND + "Expression Verified Correct:" + ANSI.RESET + " \n" + formattedExp);
|
||||
if (doCopy) Utils.copyToClip(expression);
|
||||
} else {
|
||||
System.out.println("!!!! INCORRECT !!!! \n" + expression);
|
||||
System.out.println(ANSI.RED_BACKGROUND + ANSI.BLACK + "!!!! INCORRECT !!!! \n" + ANSI.RESET + formattedExp);
|
||||
}
|
||||
} else {
|
||||
System.out.println("Exiting the program.");
|
||||
@@ -51,11 +54,14 @@ public class Main {
|
||||
public static String obfInt(int target, boolean deep) {
|
||||
if (deep) System.out.println("Deep Obfuscation is still in development!");
|
||||
StringBuilder expression = new StringBuilder();
|
||||
formattedExp.setLength(0);
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
int initializer = random.nextInt(9)+1;
|
||||
verbose("Initializing Expression: " + initializer);
|
||||
expression.append(initializer);
|
||||
formattedExp.append(ANSI.GREEN).append(initializer).append(ANSI.RESET);
|
||||
|
||||
int cubeCount = 0;
|
||||
int factorCount = 0;
|
||||
@@ -89,6 +95,7 @@ public class Main {
|
||||
perfectCount++;
|
||||
verbose("PERFECT SQUARE TIME! (" + perfectCount+ ")");
|
||||
expression.insert(0,"sqrt(").append(")");
|
||||
formattedExp.insert(0,ANSI.YELLOW_BACKGROUND + "sqrt(").append(")" + ANSI.RESET);
|
||||
eval = (int) eval(expression.toString());
|
||||
}
|
||||
|
||||
@@ -96,11 +103,11 @@ public class Main {
|
||||
mult = true;
|
||||
cubeCount++;
|
||||
verbose("Enormous than (" + cubeCount + ")");
|
||||
expression.append("+").append(Complexers.power(ri,3));
|
||||
expression.append("+").append(Increasers.power(ri,3,deep));
|
||||
} else if (target - eval > 100) {
|
||||
factorCount++;
|
||||
verbose("Large than (" + factorCount + ")");
|
||||
expression.append("+").append(Complexers.multiply(ri,10));
|
||||
expression.append("+").append(Increasers.multiply(ri,10,deep));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -111,7 +118,7 @@ public class Main {
|
||||
} else {
|
||||
rootCount++;
|
||||
}
|
||||
expression.append((mult) ? "*" : "+").append((op == 0) ? Complexers.divide(ri) : Complexers.root(ri));
|
||||
expression.append((mult) ? "*" : "+").append((op == 0) ? Complexers.divide(ri,deep) : Complexers.root(ri,deep));
|
||||
verbose("Less than (" + addCount + ")");
|
||||
}
|
||||
|
||||
@@ -124,7 +131,7 @@ public class Main {
|
||||
}
|
||||
expression.insert(0,"(").append(")");
|
||||
|
||||
expression.append("-").append((op == 0) ? Complexers.divide(ri) : Complexers.root(ri));
|
||||
expression.append("-").append((op == 0) ? Complexers.divide(ri,deep) : Complexers.root(ri,deep));
|
||||
verbose("Greater than (" + subCount + ")");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user