25 Commits

Author SHA1 Message Date
TheTrouper
9ddf4e5478 Gonna make a test at some point 2024-04-16 19:58:44 -05:00
obvWolf
89276b1f8c Did some optimizations 2024-04-15 13:41:55 -05:00
TheTrouper
e6cae61b7d Floor and cieling have been added to all 3 of the major bots, so division is now possible 2024-04-12 18:36:39 -05:00
obvWolf
922c126f96 Updated README to reflect the recent changes
Also I forgot to increment version counter so that has been done too
2023-11-07 20:57:06 -06:00
TheTrouper
da3be0db98 Merge pull request #7 from thetrouper/experimental
Experimental
2023-11-07 20:42:05 -06:00
obvWolf
df83249701 Updated gson import 2023-11-07 20:39:20 -06:00
obvWolf
2a31690d61 Cleaned up the main class and finished the config manager 2023-11-07 20:31:53 -06:00
obvWolf
256d2900ac Merge remote-tracking branch 'origin/development' into development 2023-11-06 22:39:22 -06:00
obvWolf
324e11722f Making a universal intObf that can dynamicaly toggle the complexers and increasers that it uses (currently failing at it though) 2023-11-06 22:36:41 -06:00
TheTrouper
2b9eba075e Merge pull request #6 from thetrouper/development
Development
2023-11-06 22:35:32 -06:00
TheTrouper
21e842a31e Finished up complexer picker, it has some bugs, so im making a better verbose system 2023-11-06 22:12:59 -06:00
obvWolf
b909e44e30 Starting to make a complexer toggler and picker 2023-11-06 22:12:59 -06:00
TheTrouper
33d823f754 Finished up complexer picker, it has some bugs, so im making a better verbose system 2023-11-06 16:12:54 -06:00
obvWolf
288ae6f6be Starting to make a complexer toggler and picker 2023-11-06 01:28:34 -06:00
TheTrouper
5e619ee22b Merge pull request #5 from thetrouper/development
Added Support for duckGroup
2023-11-05 12:43:50 -06:00
obvWolf
fb304993a5 Updated readme to reflect the recent changes 2023-11-05 07:38:56 -06:00
obvWolf
7a4f318be6 Added modes DuckGroup and Numselli modulus is on both of them. 2023-11-05 06:55:14 -06:00
TheTrouper
65eaa9a100 Merge pull request #4 from thetrouper/main
Sync Readme
2023-11-04 19:03:21 -05:00
TheTrouper
45afa7182d Update README.md
Updated readme to reflect recent changes
2023-11-04 18:42:31 -05:00
TheTrouper
35fbb8da8d Merge pull request #3 from thetrouper/development
Colored Output + Optimizations
2023-11-04 18:34:41 -05:00
obvWolf
aca66990b0 Finished colored output and optimized Increaser algorithm 2023-11-04 13:30:06 -05:00
TheTrouper
cd510e98de Merge pull request #2 from thetrouper/main
Sync Devel Branch
2023-11-03 23:48:56 -05:00
TheTrouper
c071727d02 Added Colors + worked on deep 2023-11-03 23:47:46 -05:00
TheTrouper
9cd3c053fd Update README.md
Updated readme make it actually useful
2023-11-02 20:56:54 -05:00
obvWolf
83aa263d01 Added options, --copy to auto copy the number to clipboard, and --verbose to enable the verbose 2023-11-02 17:25:34 -05:00
20 changed files with 1122 additions and 162 deletions

View File

@@ -16,5 +16,10 @@
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://nexus.stirante.com/repository/maven-snapshots/" />
</remote-repository>
</component>
</project>

1
.idea/misc.xml generated
View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ASMSmaliIdeaPluginConfiguration">
<asm skipDebug="true" skipFrames="true" skipCode="false" expandFrames="false" />

124
.idea/uiDesigner.xml generated Normal file
View 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>

108
README.md
View File

@@ -1,2 +1,106 @@
# Countroll
A java program to make counting bots a bit more interesting
# Countroll - Description
Countroll is designed to make using counting bots a bit more interesting. It turns integers into complex, unreadable
mathematical expressions, perfect for showing off your mathematical knowledge to you friends!
Countroll uses the following operators to make your integer as complex as possible
- Addition | +
- Subtraction | +
- Multiplication | *
- Division | /
- Square Root | sqrt()
- Exponentiation | ^
- Modulus | %
## Compatibility
Countroll is currently compatible with the following bots, please open an issue if you find another bot that is compatible or one that isn't compatible!
- [Numselli's counting bot](https://counting.numselli.xyz/)
- [DuckGroup's Counting bot](https://countingbot.com/)
## Usage
1. Compile the Java program from the source, or download a Precompiled Jar
2. Execute it through the command-line `java -jar Countroll-<version>.jar [args]`
3. Enter a target integer. (Whole number ie: 1, 16, 4096)
4. Copy the outputed expression and use it wherever you'd like!
## Arguments
There are multiple command line arguments you can use for ease of use
| Argument | Alias(es) | Description |
|-----------|-----------|---------------------------------------------------|
| --copy | -c | Automatically copies the output to your clipboard |
| --verbose | -v | Enables verbose output for debugging |
| --color | -rgb | Enables colored output for debug/it looks cool |
| --deep | -d | Will run the Complexers on the Increaser values |
| --help | --h, -h | Shows a message like this table |
| --mode | -m | Changes the mode of the bot |
# Config With Comments
Dont fancy command line interfaces? Config is now implemented with json, here is a commented version
```json
{
"printHelp": false, // Will print help then exit
"mode": "U", // Switch Modes
// U is universal, and will follow all the comlpexer toggles for fully custom setup
// D is duckgroup mode, and will not use lettered functions
// N is numselli mode, and will enable all complexers
"doCopy": false, // Automatically copies the expression to your clipboard
"deep": false, // Executes the Complexers on every integer twice (Doubles output size)
"color": true, // Makes the output Razor Chroma RGB
"useDivide": true, // Toggles the divide Complexer
"useRoot": true, // Toggles the sqrt() Complexer
"usePower": true, // Toggles the power Complexer
"useModDividend": true, // Toggles the Modulus Complexer
"show.progress": false, // Shows the current integer evaluation of the expression
"verbose.all": false, // Enables all the verbose
"verbose.processes": true, // Toggles verbose for main processes
"verbose.complexers": false, // Toggles verbose for the complexers
"verbose.increasers": false, // Toggles verbose for the increasers
"verbose.utils": false, // Toggles verbose for the utils
"verbose.eval": false, // Toggles verbose for the eval function
"verbose.loops": false, // Toggles verbose for the loops itterations
"verbose.errors": true // Toggles verbose errors
}
```
When the config generates automatically it will generate in a random order, here is the ordered version if you prefer to have it readable
```json
{
"printHelp": false,
"mode": "U",
"doCopy": false,
"deep": false,
"color": true,
"useDivide": true,
"useRoot": true,
"usePower": true,
"useModDividend": true,
"show.progress": false,
"verbose.all": false,
"verbose.processes": true,
"verbose.complexers": false,
"verbose.increasers": false,
"verbose.utils": false,
"verbose.eval": false,
"verbose.loops": false,
"verbose.errors": true
}
```
## Modes:
You can change the bot's mode with the --mode option
- `--mode=numselli` or `-m=n` Uses Square Root
- `--mode=duckgroup` or `-m=d` Does not use Square Root
- `--mode=TEST` or `-m=t` testing mode (evaluates a given expression)
DuckGroup does not support square roots, which is why they are seperate
# Compiling
Make sure you have Java 17 or higher installed on your system!
1. Clone the repo `$ git clone https://github.com/thetrouper/Countroll/`
2. Change directory to the repo `$ cd Countroll`
3. Build with gradle `$ ./gradlew build`
4. Build will be output to `/Countroll/build/libs`

View File

@@ -3,14 +3,18 @@ plugins {
}
group 'me.trouper'
version '0.0.1'
version '0.0.6'
repositories {
mavenCentral()
maven {
url 'https://nexus.stirante.com/repository/maven-snapshots/'
}
}
dependencies {
implementation 'net.objecthunter:exp4j:0.4.8'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.9'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
@@ -21,7 +25,7 @@ test {
jar {
manifest {
attributes 'Main-Class': 'me.trouper.Main'
attributes 'Main-Class': 'me.trouper.Countroll'
}
from {
configurations.runtimeClasspath.collect {

BIN
libs/gson-2.10.1.jar Normal file

Binary file not shown.

View File

@@ -0,0 +1,182 @@
package me.trouper;
import me.trouper.Data.ConfigManager;
import me.trouper.Functions.Complexers;
import me.trouper.Functions.Obf;
import me.trouper.Utils.Timer;
import me.trouper.Utils.Utils;
import me.trouper.Utils.Verbose;
import java.util.Scanner;
import static me.trouper.Functions.Eval.eval;
import static me.trouper.Utils.Utils.copyToClip;
import static me.trouper.Utils.Utils.removeColors;
public class Countroll {
public static boolean showProgress;
public static boolean doCopy;
public static boolean deep;
public static boolean color;
public static boolean printHelp;
public static String mode;
/* Statistics */
public static int errorCount = 0;
public static int expCount = 0;
public static int factorCount = 0;
public static int addCount = 0;
public static int subCount = 0;
public static int divideCount = 0;
public static int powerCount = 0;
public static int rDivisorCount = 0;
public static int rDividendCount = 0;
public static int rootCount = 0;
public static int perfectCount = 0;
public static int total = 0;
public static void clearStats() {
expCount = 0;
factorCount = 0;
addCount = 0;
subCount = 0;
divideCount = 0;
powerCount = 0;
rDivisorCount = 0;
rDividendCount = 0;
rootCount = 0;
perfectCount = 0;
total = 0;
errorCount = 0;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
ConfigManager.loadConfig();
parseCommandLineArguments(args);
Verbose.send("INIT", "Loading config");
Verbose.send("INIT", "Config loaded, mode: " + mode);
if (mode.equals("D")) {
Complexers.useRoot = false;
}
if (mode.equals("TEST")) {
handleTestMode(scanner);
}
if (printHelp) {
Utils.printHelp();
System.exit(0);
}
if (color) {
Utils.printColorKey();
}
handleTargetIntegers(scanner);
scanner.close();
}
private static void parseCommandLineArguments(String[] args) {
for (String arg : args) {
switch (arg) {
case "--copy", "-c" -> doCopy = true;
case "--verbose", "-v" -> Verbose.all = true;
case "--deep", "-d" -> deep = true;
case "--color", "-rgb" -> color = true;
case "--help", "--h", "-h" -> printHelp = true;
case "--mode=test", "-m=t" -> mode = "TEST";
case "--mode=duckgroup", "-m=d" -> mode = "D";
case "--mode=numselli", "-m=n" -> mode = "N";
case "--mode=universal", "-m=u" -> mode = "U";
}
}
}
private static void handleTestMode(Scanner scanner) {
while (true) {
System.out.print("Enter an expression (or 'exit' to exit): ");
String userInput = scanner.next();
if (userInput.equals("exit")) {
System.exit(0);
}
try {
double result = eval(userInput);
System.out.println("Result: " + result);
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}
}
}
private static void handleTargetIntegers(Scanner scanner) {
while (true) {
System.out.print("Enter Target Integer: ");
if (scanner.hasNextInt()) {
int target = scanner.nextInt();
Timer obfTimer = Timer.start();
String expression = Obf.obfInt(target);
long obfTime = obfTimer.end().timePassed();
double output = eval(removeColors(expression));
printStatistics(obfTime);
printReport(target,expression,output);
if (doCopy) copyToClip(removeColors(expression));
} else {
System.out.println("Exiting the program.");
break;
}
}
}
private static void printReport(int target, String expression, double output) {
String report;
if (target == output) {
report = String.format("""
╔═══════[ Report ]═════════
║ Target Integer: %d
║ Final Result: %s <&ah><&b>✔<&r>
║ Expression Length: %s
╚══════════════════════════
>> %s
""",target,output,expression.length(),expression);
} else {
report = String.format("""
╔═══════[ Report ]═════════
║ Target Integer: %d
║ Final Result: %s <&ch><&e>❌<&r>
║ Expression Length: %s
╚══════════════════════════
>> %s
""",target,output,expression.length(),expression);
}
System.out.println((color) ? Utils.activateColors(report) : removeColors(report));
}
private static void printStatistics(long time) {
String statistics = String.format("""
╔═══════[ Statistics ]═════════
║ Exponents: %d
║ Factors: %d
║ Additions: %d
║ Subtractions: %d
║ Divisors: %d
║ Powers: %d
║ mRootDividends: %d
║ Roots Taken: %d
║ Perfect Squares Found: %d
║ Errors: %d
╠══════════════════════════════
║ Total steps taken: %d
║ Elapsed Time: %d
╚══════════════════════════════
""", expCount, factorCount, addCount, subCount, divideCount, powerCount, rDividendCount, rootCount, perfectCount, errorCount, total, time);
System.out.println(statistics);
}
}

View File

@@ -0,0 +1,90 @@
package me.trouper.Data;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonIOException;
import com.google.gson.JsonSyntaxException;
import me.trouper.Countroll;
import me.trouper.Functions.Complexers;
import me.trouper.Functions.Obf;
import me.trouper.Utils.Verbose;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
public class ConfigManager {
private static final String CONFIG_FILENAME = "countroll.json";
public static void loadConfig() {
File configFile = new File(CONFIG_FILENAME);
if (!configFile.exists()) {
generateDefaultConfig();
} else {
try (Reader reader = new FileReader(configFile)) {
Gson gson = new Gson();
Map<String, Object> config = gson.fromJson(reader, HashMap.class);
getConfig(config);
} catch (JsonSyntaxException | JsonIOException | IOException e) {
e.printStackTrace();
generateDefaultConfig();
}
}
}
private static void generateDefaultConfig() {
Map<String, Object> defaultConfig = new HashMap<>();
defaultConfig.put("useDivide", true);
defaultConfig.put("usePower", true);
defaultConfig.put("useRoot", true);
defaultConfig.put("useModDividend", true);
defaultConfig.put("useSquareFinder", true);
defaultConfig.put("doCopy", false);
defaultConfig.put("doSafeSubtract", true);
defaultConfig.put("deep", false);
defaultConfig.put("color", true);
defaultConfig.put("printHelp", false);
defaultConfig.put("mode", "U");
defaultConfig.put("show.progress", false);
defaultConfig.put("verbose.all",false);
defaultConfig.put("verbose.processes",true);
defaultConfig.put("verbose.loops",false);
defaultConfig.put("verbose.eval",false);
defaultConfig.put("verbose.complexers",false);
defaultConfig.put("verbose.increasers",false);
defaultConfig.put("verbose.utils",false);
defaultConfig.put("verbose.errors",true);
try (Writer writer = new FileWriter(CONFIG_FILENAME)) {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
gson.toJson(defaultConfig, writer);
} catch (IOException e) {
e.printStackTrace();
}
getConfig(defaultConfig);
}
private static void getConfig(Map<String, Object> config) {
Verbose.send("INIT", "Loading main class variables");
Complexers.useDivide = (boolean) config.get("useDivide");
Complexers.usePower = (boolean) config.get("usePower");
Complexers.useRoot = (boolean) config.get("useRoot");
Complexers.useRDividend = (boolean) config.get("useModDividend");
Countroll.showProgress = (boolean) config.get("show.progress");
Countroll.doCopy = (boolean) config.get("doCopy");
Countroll.deep = (boolean) config.get("deep");
Countroll.color = (boolean) config.get("color");
Countroll.printHelp = (boolean) config.get("printHelp");
Countroll.mode = (String) config.get("mode");
Verbose.all = (boolean) config.get("verbose.all");
Verbose.processes = (boolean) config.get("verbose.processes");
Verbose.loops = (boolean) config.get("verbose.loops");
Verbose.eval = (boolean) config.get("verbose.eval");
Verbose.complexers = (boolean) config.get("verbose.complexers");
Verbose.increasers = (boolean) config.get("verbose.increasers");
Verbose.utils = (boolean) config.get("verbose.utils");
Verbose.errors = (boolean) config.get("verbose.errors");
Verbose.send("INIT","mode = " + Countroll.mode);
}
}

View File

@@ -0,0 +1,49 @@
package me.trouper.Data;
import java.util.HashMap;
import java.util.Map;
public class MC2Ansi {
public static Map<String, String> getColors() {
Map<String, String> minecraftToAnsi = new HashMap<>();
minecraftToAnsi.put("<&0>", "\u001B[0;30m");
minecraftToAnsi.put("<&1>", "\u001B[0;34m");
minecraftToAnsi.put("<&2>", "\u001B[0;32m");
minecraftToAnsi.put("<&3>", "\u001B[0;36m");
minecraftToAnsi.put("<&4>", "\u001B[0;31m");
minecraftToAnsi.put("<&5>", "\u001B[0;35m");
minecraftToAnsi.put("<&6>", "\u001B[0;33m");
minecraftToAnsi.put("<&7>", "\u001B[0;37m");
minecraftToAnsi.put("<&8>", "\u001B[1;30m");
minecraftToAnsi.put("<&9>", "\u001B[1;34m");
minecraftToAnsi.put("<&a>", "\u001B[1;32m");
minecraftToAnsi.put("<&b>", "\u001B[1;36m");
minecraftToAnsi.put("<&c>", "\u001B[1;31m");
minecraftToAnsi.put("<&d>", "\u001B[1;35m");
minecraftToAnsi.put("<&e>", "\u001B[1;33m");
minecraftToAnsi.put("<&f>", "\u001B[1;37m");
minecraftToAnsi.put("<&r>", "\u001B[0m");
return minecraftToAnsi;
}
public static Map<String, String> getBackgrounds() {
Map<String, String> minecraftToAnsiBG = new HashMap<>();
minecraftToAnsiBG.put("<&0h>", "\u001B[40m");
minecraftToAnsiBG.put("<&1h>", "\u001B[44m");
minecraftToAnsiBG.put("<&2h>", "\u001B[42m");
minecraftToAnsiBG.put("<&3h>", "\u001B[46m");
minecraftToAnsiBG.put("<&4h>", "\u001B[41m");
minecraftToAnsiBG.put("<&5h>", "\u001B[45m");
minecraftToAnsiBG.put("<&6h>", "\u001B[43m");
minecraftToAnsiBG.put("<&7h>", "\u001B[47m");
minecraftToAnsiBG.put("<&8h>", "\u001B[40;1m");
minecraftToAnsiBG.put("<&9h>", "\u001B[44;1m");
minecraftToAnsiBG.put("<&ah>", "\u001B[42;1m");
minecraftToAnsiBG.put("<&bh>", "\u001B[46;1m");
minecraftToAnsiBG.put("<&ch>", "\u001B[41;1m");
minecraftToAnsiBG.put("<&dh>", "\u001B[45;1m");
minecraftToAnsiBG.put("<&eh>", "\u001B[43;1m");
minecraftToAnsiBG.put("<&fh>", "\u001B[47;1m");
return minecraftToAnsiBG;
}
}

View File

@@ -1,43 +1,143 @@
package me.trouper.Functions;
import java.util.Random;
import me.trouper.Countroll;
import me.trouper.Utils.Utils;
import me.trouper.Utils.Verbose;
import java.util.*;
import static me.trouper.Functions.Eval.eval;
import static me.trouper.Functions.Eval.isPerfectSquare;
public class Complexers {
public static String divide(int i) {
/* Complexer Toggles */
public static boolean useDivide;
public static boolean usePower;
public static boolean useRoot;
public static boolean useRDividend;
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");
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" -> {
if (!isPerfectSquare(i)) {
return divide(i,deep);
}
return power(i,deep);
}
case "root" -> {
return root(i,deep);
}
case "mrDividend" -> {
return mRootDividend(i,deep);
}
default -> {
return divide(i,false);
}
}
}
/**
* Safe to use with D mode
* @param i Integer to divide
* @return Colored String
*/
public static String divide(int i, boolean deep) {
Verbose.send("COMP", "Running Divide Complexer, I:" + i + " Deep: " + deep);
Countroll.divideCount++;
Random random = new Random();
int factor = random.nextInt(9)+1;
int doubled = i * factor;
String result = "(" + doubled + "/" + factor + ")";
if (eval(result) == i) {
return result;
String result = "<&f>(<&r><&e>" + doubled + "<&b>/<&r><&e>" + factor + "<&f>)<&r>";
if (deep) {
result = "<&3>(<&r><&d>" + (complex(doubled,false)) + "<&b>/<&r><&d>" + (complex(factor,false)) + "<&3>)<&r>";
}
return "(" + i + ")";
if (eval(result) != i) Verbose.send("ERR","<&ch>Failed to divide <&r>" + i + ", Attempted: " + result + "=" + eval(result));
return eval(result) == i ? result : "<&ch>(" + i + ")<&r>";
}
public static String multiply(int i, int factor) {
String result = "(" + i + "*" + factor + ")";
if (eval(result) == i * factor) {
return result;
/**
* Safe to use with D mode
* Only to be used with perfect squares
* @param i Integer to root+square
* @return Colored String
*/
public static String power(int i, boolean deep) {
Verbose.send("COMP", "Running Power Complexer, I:" + i + " Deep: " + deep);
Countroll.powerCount++;
int root = (int) Math.sqrt(i);
String result = "<&r><&f>(<&e>" + root + "<&b>^<&e>2<&f>)<&r>";
if (deep) {
result = "<&r><&3>(<&d>" + complex(root,false) + "<&b>^<&d>2<&3>)<&r>";
}
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 + ")";
if (eval(result) != i) Verbose.send("ERR","<&ch>Failed to power <&r>" + i + ", Attempted: " + result + "=" + eval(result));
return eval(result) == i ? result : "<&ch>(" + i + ")<&r>";
}
public static String root(int i) {
/**
* Uses sqrt(), not safe with D mode
* @param i integer to square+root
* @return Colored String
*/
public static String root(int i, boolean deep) {
Verbose.send("COMP", "Running Root Complexer, I:" + i + " Deep: " + deep);
Countroll.rootCount++;
int squared = (int) Math.pow(i,2);
String result = "sqrt(" + squared + ")";
if (eval(result) == i){
return result;
String result = "<&9>sqrt<&r><&f>(<&r><&e>" + squared + "<&f>)<&r>";
if (deep) {
result = "<&1>sqrt<&r><&3>(<&r><&d>" + complex(squared, false) + "<&3>)<&r>";
}
return "(" + i + ")";
if (eval(result) != i) Verbose.send("ERR","<&ch>Failed to root <&r>" + i + ", Attempted: " + result + "=" + eval(result));
return (eval(result) == i) ? result : "<&ch>(" + i + ")<&r>";
}
/**
* Uses modulus (dividend%ri)=i
* @param i Modulus to return
* @return Colored String
*/
public static String mRootDividend(int i, boolean deep) {
Verbose.send("COMP", "Running mrDividend Complexer, I:" + i + " Deep: " + deep);
Countroll.rDividendCount++;
Random random = new Random();
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>";
}
Verbose.send("COMP","<&dh><&b>mRootDividend has been ran!<&r>" +
"\nWanted:" + i +
"\nDivisor: " + divisor +
"\nDividend: " + dividend +
"\nCheck: " + dividend + "%" + divisor + "=" + i +
"\nResult: " + result);
if (eval(result) != i) Verbose.send("ERR","<&ch>Failed to mRootDividend<&r> " + i + ", Attempted: " + result + "=" + eval(result));
return (eval(result) == i) ? result : "<&ch>(" + i + ")<&r>";
}
}

View File

@@ -0,0 +1,7 @@
package me.trouper.Functions;
public class Decreasers {
public static String divide() {
return null;
}
}

View File

@@ -1,19 +1,21 @@
package me.trouper.Functions;
import me.trouper.Utils.Utils;
import me.trouper.Utils.Verbose;
import net.objecthunter.exp4j.Expression;
import net.objecthunter.exp4j.ExpressionBuilder;
public class Eval {
public static double eval(String expression) {
Expression exp = new ExpressionBuilder(expression).build();
final String cleaned = Utils.removeColors(expression);
Verbose.send("EVAL","Evaluating Expression: " + cleaned);
Expression exp = new ExpressionBuilder(cleaned).build();
return exp.evaluate();
}
public static boolean isPerfectSquare(int num) {
if (num < 0) {
return false;
}
int sqrt = (int) Math.sqrt(num);
return sqrt * sqrt == num;
if (num == 0 || num == 1) return false;
final double sq = Math.sqrt(num);
return sq == Math.floor(sq);
}
public static boolean isInt(double number) {
return (number == Math.floor(number)) && !Double.isInfinite(number);

View File

@@ -0,0 +1,69 @@
package me.trouper.Functions;
import me.trouper.Countroll;
import me.trouper.Utils.Utils;
import me.trouper.Utils.Verbose;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static me.trouper.Functions.Eval.eval;
import static me.trouper.Functions.Eval.isPerfectSquare;
public class Increasers {
public static String increase(int current, int target, int i, boolean deep) {
if (target - current > 64000) {
Countroll.expCount++;
return Increasers.power(i,4,deep);
} else if (target - current > 4069) {
Countroll.expCount++;
return Increasers.power(i,3,deep);
} else if (target - current > 1048) {
Countroll.expCount++;
return Increasers.power(i,2,deep);
} else if (target - current > 128) {
Countroll.factorCount++;
return Increasers.multiply(i,9,deep);
} else {
return multiply(i,2,deep);
}
}
public static String multiply(int i, int factor, boolean deep) {
Countroll.factorCount++;
String result;
if (deep) {
result = "<&7>(<&r><&2>" + (Complexers.complex(i,true)) + "<&b>*<&r><&2>" + Complexers.complex(i,true) + "<&7>)<&r>";
if (eval(result) == i * factor) return result;
}
result = "<&7>(<&r><&2>" + i + "<&b>*<&r><&2>" + factor + "<&7>)<&r>";
double calc = eval(result);
if (!(calc == Math.multiplyExact(i,factor))) Verbose.send("ERR", "Failed multiply increaser! " +
"\nAttempted expression: " + result +
"\nTarget: " + i +
"\nCalc: " + calc);
return calc == i * factor ? result : "(" + i + ")";
}
public static String power(int i, int exp, boolean deep) {
Countroll.powerCount++;
String result;
if (deep) {
result = "<&7>(<&r><&2>" + Complexers.complex(i,true) + "<&b>^<&r><&2>" + Complexers.complex(i,true) + "<&7>)<&r>";
if (eval(result) == Math.pow(i,exp)) return result;
}
result = "<&7>(<&r><&2>" + i + "<&b>^<&r><&2>" + exp + "<&7>)<&r>";
double calc = eval(result);
if (!(calc == Math.pow(i,exp))) Verbose.send("ERR", "Failed multiply increaser! " +
"\nAttempted expression: " + result +
"\nTarget: " + i +
"\nCalc: " + calc);
return calc == Math.pow(i,exp) ? result : "(" + i + ")";
}
}

View File

@@ -0,0 +1,102 @@
package me.trouper.Functions;
import me.trouper.Countroll;
import me.trouper.Utils.Verbose;
import java.util.Random;
import static me.trouper.Functions.Eval.*;
import static me.trouper.Functions.Eval.eval;
import static me.trouper.Utils.Utils.removeColors;
public class Obf {
public static String obfInt(int target) {
Verbose.send("PROC", "Starting Obfuscation (Universal)");
StringBuilder expression = new StringBuilder();
Random rand = new Random();
// INIT
int init = rand.nextInt(9)+1;
Verbose.send("PROC", "Initializing Expression: " + init);
expression.append("<&dh><&f>").append(init).append("<&r>");
// MAIN LOOP
Verbose.send("PROC", "Beginning Main Loop: ");
while (eval(expression.toString()) != target) {
Countroll.total++;
int current = (int) eval(expression.toString());
int ri = rand.nextInt(9)+1;
if (Countroll.showProgress) System.out.println("Current Evaluation: " + current);
// Checking for it still being a whole number
if (!isInt(eval(expression.toString()))) {
System.out.println("Something went horribly wrong, Here is the relevant info." +
"\nEvaluation: " + eval(expression.toString()) +
"\nRandom Pick: " + ri +
"\nCaught at: \n" + removeColors(expression.toString()));
break;
}
String comp = Complexers.complex(ri,Countroll.deep);
String incr = Increasers.increase(current,target,ri,Countroll.deep);
String rounder = rand.nextBoolean() ? "floor(" : "ceil(";
boolean front = rand.nextBoolean();
// Case for if its below
if (isPerfectSquare(current)) {
expression.insert(0,"<&eh><&b>sqrt(<&r>");
expression.append("<&eh><&b>)<&r>");
continue;
}
if (current < target) {
Countroll.addCount++;
//expression.insert(0,"<&b>+<&r><&e>").insert(0,comp);
String toAdd = comp;
if (target - current > 128) {
toAdd = incr;
}
if (front) {
if (toAdd.equals(comp)) {
toAdd = toAdd + "<&b>+<&r><&e>";
expression.insert(0,toAdd);
continue;
}
toAdd = toAdd + "<&b>*<&r><&e>";
expression.insert(0,toAdd);
continue;
}
if (toAdd.equals(comp)) {
toAdd = "<&b>+<&r><&e>" + toAdd;
expression.append(toAdd);
continue;
}
toAdd = "<&b>*<&r><&e>" + toAdd;
expression.append(toAdd);
continue;
}
// Case for if its above
if (current > target) {
Countroll.subCount++;
String toAdd = comp;
if (current - target > 128) {
toAdd = incr;
}
if (toAdd.equals(comp)) {
toAdd = "<&b>-<&r><&e>" + toAdd;
expression.append(toAdd);
continue;
}
toAdd = "<&b>/<&r><&e>" + toAdd;
expression.insert(0,rounder);
expression.append(toAdd).append(")");
continue;
}
}
Verbose.send("PROC", "Broke out of loop.");
return expression.toString();
}
}

View File

@@ -1,127 +0,0 @@
package me.trouper;
import me.trouper.Functions.Complexers;
import java.util.Random;
import java.util.Scanner;
import static me.trouper.Functions.Eval.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.print("Enter Target Integer: ");
if (scanner.hasNextInt()) {
int target = scanner.nextInt();
String expression = obfInt(target);
double output = eval(expression);
System.out.println("\nTarget Integer: " + target);
if (output == target) {
System.out.println("Expression Verified Correct: \n" + expression);
} else {
System.out.println("!!!! INCORRECT !!!! \n" + expression);
}
} else {
System.out.println("Exiting the program.");
break;
}
}
scanner.close();
}
public static String obfInt(int target) {
StringBuilder expression = new StringBuilder();
Random random = new Random();
int initializer = random.nextInt(9)+1;
System.out.println("Initializing Expression: " + initializer);
expression.append(initializer);
int cubeCount = 0;
int factorCount = 0;
int addCount = 0;
int subCount = 0;
int rootCount = 0;
int divideCount = 0;
int perfectCount = 0;
int total = 0;
while (eval(expression.toString()) != target) {
total++;
int eval = (int) eval(expression.toString());
int ri = random.nextInt(9)+1;
int op = random.nextInt(2);
if (!isInt(eval(expression.toString()))) {
System.out.println("Something went horribly wrong, Here is the relevant info." +
"\nEvaluation: " + eval(expression.toString()) +
"\nRandom Pick: " + ri +
"\nOperation: " + op +
"\nCaught at: \n" + expression);
break;
}
System.out.println("Random: " + ri);
System.out.println("Current: " + eval(expression.toString()));
if (isPerfectSquare(eval)) {
perfectCount++;
System.out.println("PERFECT SQUARE TIME! (" + perfectCount+ ")");
expression.insert(0,"sqrt(").append(")");
eval = (int) eval(expression.toString());
}
if (target - eval > 1000) {
cubeCount++;
System.out.println("Enormous than (" + cubeCount + ")");
expression.append("+").append(Complexers.power(ri,3));
} else if (target - eval > 100) {
factorCount++;
System.out.println("Large than (" + factorCount + ")");
expression.append("+").append(Complexers.multiply(ri,10));
}
if (eval < target) {
addCount++;
if (op == 0) {
divideCount++;
} else {
rootCount++;
}
expression.append("+").append((op == 0) ? Complexers.divide(ri) : Complexers.root(ri));
System.out.println("Less than (" + addCount + ")");
}
if (eval > target) {
subCount++;
if (op == 0) {
divideCount++;
} else {
rootCount++;
}
expression.insert(0,"(").append(")");
expression.append("-").append((op == 0) ? Complexers.divide(ri) : Complexers.root(ri));
System.out.println("Greater than (" + subCount + ")");
}
}
System.out.println("Broke out of loop. Value: " + eval(expression.toString()));
System.out.println("Expression: " + expression.toString());
System.out.println("Statistics: " +
"\nCubes: " + cubeCount +
"\nFactors: " + factorCount +
"\nAdditions: " + addCount +
"\nSubtractions: " + subCount +
"\nRoots Taken: " + rootCount +
"\nDivisors " + divideCount +
"\nPerfect Squares Found: " + perfectCount +
"\nTotal steps taken: " + total);
return expression.toString();
}
}

View File

@@ -0,0 +1,93 @@
package me.trouper.Utils;
public class Timer {
/* Timer Curtosy of ImproperIssues
* https://your-mom-is-so-fat-we-couldnt-fit-her-in-this-doma.in/tugdkppa.png
* Yes, I got permission to use it this time! */
public static final long MILLIS_IN_SECOND = 1000L;
public static final long MILLIS_IN_MINUTE = MILLIS_IN_SECOND * 60L;
public static final long MILLIS_IN_HOUR = MILLIS_IN_MINUTE * 60L;
public static final long MILLIS_IN_DAY = MILLIS_IN_HOUR * 24L;
private long start;
private Timer() {
this.start = System.currentTimeMillis();
}
public static Timer start() {
return new Timer();
}
public static End zero() {
return new End(0);
}
public End end() {
return new End(start);
}
public static class End {
private final long start;
private final long end;
private End(long start) {
this.end = System.currentTimeMillis();
this.start = start;
}
public long timePassed() {
return end - start;
}
public String getStamp(boolean day, boolean hr, boolean min, boolean sec, boolean ms) {
long time = timePassed();
String stamp = "";
if (day) {
long l = (long)Math.floor((double)time / (double)MILLIS_IN_DAY);
time -= l * MILLIS_IN_DAY;
if (l > 0L) stamp += l + "d";
}
if (hr) {
long l = (long)Math.floor((double)time / (double)MILLIS_IN_HOUR);
time -= l * MILLIS_IN_HOUR;
if (l > 0L) stamp += " " + l + "hr";
}
if (min) {
long l = (long)Math.floor((double)time / (double)MILLIS_IN_MINUTE);
time -= l * MILLIS_IN_MINUTE;
if (l > 0L) stamp += " " + l + "min";
}
if (sec) {
long l = (long)Math.floor((double)time / (double)MILLIS_IN_SECOND);
time -= l * MILLIS_IN_SECOND;
if (l > 0L) stamp += " " + l + "sec";
}
if (ms) {
if (time > 0L) stamp += " " + time + "ms";
}
return stamp.trim();
}
public String getStampStandard() {
return getStamp(false, true, true, false, false);
}
public String getStampLogger() {
return getStamp(false, true, true, true, false);
}
public String getStampPrecise() {
return getStamp(false, false, true, true, true);
}
public String getStampFull() {
return getStamp(true, true, true, true, true);
}
}
}

View File

@@ -0,0 +1,120 @@
package me.trouper.Utils;
import me.trouper.Data.MC2Ansi;
import me.trouper.Countroll;
import me.trouper.Functions.Eval;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.util.Map;
public class Utils {
public static int calcExp(int difference) {
int result = 1;
if (difference >= 4096) result = 2;
if (difference >= 8192) result = 3;
if (difference >= 16384) result = 4;
if (difference >= 32768) result = 5;
if (difference >= 65536) result = 6;
if (difference >= 131072) result = 7;
if (difference >= 262144) result = 8;
if (difference >= 524288) result = 9;
if (difference >= 1048576) result = 10;
return result;
}
public static void copyToClip(String text) {
StringSelection parsed = new StringSelection(text);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(parsed,null);
}
public static String removeColors(String input) {
return input.replaceAll("<&[0-9a-fr]>|<&[0-9a-frh]h>", "");
}
public static String activateColors(String input) {
Map<String, String> minecraftToAnsi = MC2Ansi.getColors();
Map<String, String> minecraftBackgroundsToAnsi = MC2Ansi.getBackgrounds();
for (Map.Entry<String, String> entry : minecraftToAnsi.entrySet()) {
input = input.replace(entry.getKey(), entry.getValue());
}
for (Map.Entry<String, String> entry : minecraftBackgroundsToAnsi.entrySet()) {
input = input.replace(entry.getKey(), entry.getValue());
}
input += "\u001B[0m\u001B[49m";
return input;
}
public static void printHelp() {
System.out.println("""
Usage: java -jar Countroll-<version>.jar [options]
Options: values are formated as such: -m=d or -t=root
--copy, -c Copy the generated expression to the clipboard
--verbose, -v Enable verbose mode
--deep, -d Enable deep obfuscation (under development)
--color, -rgb Enable colored output
--help, --h, -h Show this help message
--mode, -m Toggle the mode Values (Long): [duckgroup, numselli, universal, testing] Values (Brief): [d, n, u, t]
--toggle, -t Toggle off Complexer Values: [divide, power, root, mrDividend, mrDivisor, perfect]
Note: When using multiple options, separate them with spaces.""");
System.exit(0);
}
public static void printColorKey() {
String colorKey = "\nColor Key: " +
"\n<&c>Red Parentheses:<&r> Gets Subtracted" +
"\n<&b><&eh>Blue/Yellow:<&r> Perfect Square" +
"\n<&a>Green:<&r> Increaser" +
"\n<&9>Blue:<&r> Operation" +
"\n<&e>Yellow:<&r> Complexer" +
"\n<&b><&d&h>Blue/Purple:<&r> Safe Subtract" +
"\n<&3>Cyan:<&r> Deep Complexer";
System.out.println(activateColors(colorKey));
}
/**
* Returns the divisor of a mod equation given the modulus and dividend
* 5%x=2 -> x=3
* @param modulus Remainder
* @param dividend The number that is getting divided
* @return The divisor
*/
public static int moduRootDivisor(int dividend, int modulus) {
int divisor = dividend - modulus;
Verbose.send("UTIL","<&1h><&e>Finding mrDivisor:<&r> " +
"\nDividend (Given): " + dividend +
"\nDivisor (Unknown): " + divisor +
"\nModulus (Given): " + modulus +
"\nCheck: " + dividend + "%" + divisor + "=" + Eval.eval(dividend + "%" + divisor));
return divisor;
/*
int divisor = 1;
while (divisor * dividend % modulus != 0 || divisor != 1) {
divisor++;
}
return divisor;*/
}
/**
* Returns the dividend of a mod equation given the modulus and divisor
* x%3=2 -> x=5
* @param modulus Remainder
* @param divisor The number that does the dividing
* @return The dividend
*/
public static int moduRootDividend(int divisor, int modulus) {
int dividend = modulus + divisor;
Verbose.send("UTIL","<&1h><&e>Finding mrDivisor:<&r> " +
"\nDividend (Unknown): " + dividend +
"\nDivisor (Given): " + divisor +
"\nModulus (Given): " + modulus);
return dividend;
}
}

View File

@@ -0,0 +1,32 @@
package me.trouper.Utils;
import me.trouper.Countroll;
public class Verbose {
public static boolean processes;
public static boolean all;
public static boolean loops;
public static boolean eval;
public static boolean complexers;
public static boolean increasers;
public static boolean utils;
public static boolean errors;
public static void send(String type, String message) {
message = Utils.activateColors(message);
if (all) {
System.out.println(message);
return;
}
if (type.equals("INIT")) System.out.println(message);
if (type.equals("PROC") && processes) System.out.println(message);
if (type.equals("LOOP") && loops) System.out.println(message);
if (type.equals("UTIL") && utils) System.out.println(message);
if (type.equals("EVAL") && eval) System.out.println(message);
if (type.equals("COMP") && complexers) System.out.println(message);
if (type.equals("INCR") && increasers) System.out.println(message);
if (type.equals("ERR") && errors) {
System.out.println(message);
Countroll.errorCount++;
}
}
}

View File

@@ -1,2 +1,2 @@
Manifest-Version: 1.0
Main-Class: me.trouper.Main
Main-Class: me.trouper.Countroll

5
src/test/java/Main.java Normal file
View File

@@ -0,0 +1,5 @@
public class Main {
public static void main(String[] args) {
}
}