Results 1 to 10 of 19

Thread: Grief's Scripts,

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    aaaaaaaaaaaaaaaaaaaaaaaaa Grief Hero's Avatar
    Join Date
    Jun 2013
    Location
    n/a
    Posts
    1,327

    Grief's Scripts,

    This is basically a thread about my scripts.

    So, I didn't have any ideas for something to script, so I was doing math, and it came to me, why not make an algebra solver?
    I then proceeded to create one in Java and GS2, but I wanted something that could support user input, and why not use BATCH for that? I know I can do user input with java and GS2, but I'm to lazy to try right now.
    Also, sorry for all the messiness.
    Here are all 3 scripts


    Java:Very fast
    PHP Code:

    package solver
    ;

    public class 
    main {
        public static 
    void main(String args[]) {
            
    float uk=0//unknown variable
            
    float thing 30//known variable
            
    float ans 2700;  //the answer the equation
            
    boolean tr;
            while(
    uk<ans) {
                 
    uk++;
                
    float solv uk;
                if (
    uk>100000//do not remove this unless your answer is larger than 10000
                

                    break;
                }
                if (
    solv/thing!=ans) { //change the / to whatever mathematical symbol you require
                     
    tr true;
                }
                if (
    tr=true) {
                 
    System.out.println(solv/thing);        
        }  
            }
       }
           } 
    GS2: Slower
    PHP Code:
    function onCreated() {  
       
    uk 0//leave this alone, can be a neg if desired.
        
    thing 10//then the known number
        
    equ ans/uk;
        
    ans 100//place the answer to your equation here.
        
    while(uk+1<=ans) {
          
    uk++;
          
    solve uk;
          
    sleep(0.05);
          if (
    ans/uk=thing) { //replace the / with the mathematical symbol you require.
             
    echo("The answer is" SPC uk);
          }
        } 
      } 
    and BATCH:Very slow if the number is large

    PHP Code:
    @echo off
    :TOP
    set x
    =0
    set solv
    =0
    set TEST
    =0
    echo User InputType in what is being added to X
    set 
    /p ADDER=
    cls

    echo User InputType in what the answer to the equation is:
    set /p ANS=
    cls

    :QUEST
    echo User InputWould you like your x to start as a negative number?
    set /p YES=
    cls
    if /"%YES%"=="yes" goto :NEG
    if /"%YES%"=="no" goto :Repeat
    goto :QUEST

    :NEG
    set 
    /a x=0-ANS-1000
    goto :Repeat




    :Repeat
    if "%solv%"=="1" goto :ANSWERED
    set 
    /a x=%x%+1
    set 
    /a TEST=%x%+"%ADDER%"
    if "%test%"=="%Ans%" goto :SETSOLVE
    echo %x%

    if 
    "%x%"=="100000" goto :Fail
    goto :Repeat

    :SETSOLVE
    set solv
    =1
    goto :Repeat

    :ANSWERED
    cls
    echo %x%
    pause
    cls
    goto :TOP

    :Fail
    cls
    color c0
    echo Fatal Error has occured:
    echo 
    Buffer Overflow Error
    pause
    color 07
    cls
    goto :TOP 
    Last edited by Grief Hero; 04-17-2014 at 05:01 AM.


    I saw. I conquered. I came.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •