Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Script by u/Risoka
- You use it with any arg you want. Yes, any. (but no big numbers) */
- import java.util.*;
- public class Main
- {
- /* variable to see if its star trek mode */ public static int ISSTARTREKMODE = 0;
- public static void main(String[] args) throws InterruptedException {
- /* I'll use double to make sure we can calculate any number */ double L[] = new double[args.length];
- /* Here too */ double P = 0;
- for (int INT = 0; INT < args.length; INT++) {
- if (!ISNOTINT(GETARGVALUE(args, INT))) {
- /* use byte to be more resource friendly */ L[INT] = GETARGVALUEASBYTE(args,INT);}}
- for (int INT = 0; INT < args.length; INT++) {
- if (L[INT] != 0)
- P = P + L[INT];}
- System.out.print("Working on number: " + P);
- System.out.print("\nDo you want to continue? [YES]/[no]");
- Scanner A = new Scanner(System.in);
- String B = A.nextLine();
- //double V = Integer.parseInt(getargvalue(args,0))*1.0; //old dont use
- double V = P;
- P = 0;
- int interation = 1;
- for (interation = 1;interation<10E6;interation++){
- P = V + (Math.pow(-1,(interation+1))/(2*interation-1)) + P;
- //advanced math
- }
- /* User don't want to know the answer. We need to close the request ***TODO*** */if (B.equals("no")) { Thread.sleep(4000); System.out.print("Ok, bye."); return;}
- if (args.length > 1) {
- for (int INT = 0; INT < args.length; INT++) {
- if (GETARGVALUE(args,INT).equals("star_trek")){
- ISSTARTREKMODE = ISSTARTREKMODE + 1;}}}
- if (ISSTARTREKMODE == 0){
- P = P - (interation-1) * V;
- P = 4 * P;
- P = P * 3;
- P = P * 2;
- P = P * 7;
- P = P/Math.PI;
- P = (int)P;
- }
- if (ISSTARTREKMODE != 0){
- //star trek mode, works for any number or star_trek flags to fix bug
- P = P - (interation - 1) * V;
- P = 4 * P;
- P = P * 3;
- P = 2 * P;
- P = P * 7;
- P = P/Math.PI;
- P = Math.round(P + (int)(2*Math.PI) - Math.pow(Math.PI, 0));
- }
- Thread.currentThread().sleep(2000);
- System.out.print("Calculating.");
- Thread.currentThread().sleep(500);
- System.out.print(" .");
- Thread.currentThread().sleep(500);
- System.out.print(" .\n");
- Thread.currentThread().sleep(1000);
- System.out.print("Waiting for approval.");
- Thread.currentThread().sleep(500);
- System.out.print(" .");
- Thread.currentThread().sleep(500);
- System.out.print(" .\n");
- Thread.currentThread().sleep(1000);
- System.out.print("Matrix aproval granted.");
- Thread.currentThread().sleep(500);
- System.out.print(" .");
- Thread.currentThread().sleep(500);
- System.out.print(" .\n");
- Thread.currentThread().sleep(1000);
- System.out.print("The final result is:\n");
- Thread.currentThread().sleep(1000);
- System.out.print(P);
- }
- public static byte GETARGVALUEASBYTE(String[] a, int i){
- try{
- Byte.parseByte(GETARGVALUE(a, i));
- }
- catch(NumberFormatException e) {
- if (Integer.parseInt(GETARGVALUE(a, i))>126){
- System.out.println("values in the arg > 126 will be interpreted as 126, sorry");
- return (byte)126;
- }
- if (Integer.parseInt(GETARGVALUE(a, i))<-126){
- System.out.println("values in the arg < -126 will be interpreted as -126, sorry");
- return (byte)-126;
- }
- return 0;
- }
- return Byte.parseByte(GETARGVALUE(a, i)); }
- public static String GETARGVALUE(String[] a, int i) {
- String r = new String(a[i]);
- return r; }
- public static boolean ISNOTINT(String s) {
- try {
- Integer.parseInt(s);
- } catch(NumberFormatException e) {
- return true;} return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment