Results 1 to 5 of 5

Thread: speed up prog in java

  1. #1
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407

    speed up prog in java

    Alright, someone pm'd me with a program that they want to speed up in java. I have no clue where to start because when I copy and paste the program it gives me an error that the SpikeLib package doesn't exist. i'm thinking he is in a class where they were able to download this package and I don't have access to it. Here is the program:

    Code:
    import SpikeLib.*;
    import corejava.Console;
    public class SquareSpike
    {
    
        public static void main (String args [])
    
        {
           SpikeWindow window ;
           Spike mySpike ;
    
           mySpike = new Spike ();
           window = new SpikeWindow ();
           window.addSpike (mySpike);
    
    
           int sides;
           sides = Console.readInt("Enter Number Of Sides");
    
           window.show();
    
    
           for (int i = 0; i < sides; i++)
           {
              mySpike.moveEast();
           }
    
           for (int i = 0; i < sides; i++)
           {
              mySpike.moveNorth();
           }
    
           for (int i = 0; i < sides; i++)
           {
              mySpike.moveWest();
           }
    
           for (int i = 0; i < sides; i++)
           {
              mySpike.moveSouth();
           }
        }
    }
    He wants it to run 50 times faster. Mooret, if you're out there, I've got the whole AO crew working on your prog, so it should be solved in not time.
    Thanks for the help.

  2. #2
    Just a Virtualized Geek MrLinus's Avatar
    Join Date
    Sep 2001
    Location
    Redondo Beach, CA
    Posts
    7,323
    http://www.compneuro.org/CDROM/calab....example-Linux <--- spikelib seems to be part of a simulator (network?) simulator called GENESIS, found here I believe.
    Goodbye, Mittens (1992-2008). My pillow will be cold without your purring beside my head
    Extra! Extra! Get your FREE copy of Insight Newsletter||MsMittens' HomePage

  3. #3
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    Thank you MsM for the reply, I just have no clue what to do with that code. It's not even mine so I'm not going to worry about it. I have an announcement to make though:
    I will be starting the third project for my cs class which is found here:
    http://www.cs.utsa.edu/~wagner/CS171.../project3.html
    If anyone wants to get a little practice in java they can also try and do this project. I will post my code on Tuesday night because the project is due on wednesday, so try and have it done so you can compare to my code. I'm not saying that my code will be the exact answer because there are probably at least 10 ways to do most any program. I also might need help so be watching this forum for another post by me because I could really use you guys.
    Wish me luck.

  4. #4
    Senior Member
    Join Date
    May 2002
    Posts
    344
    sounds like fun and i think i know enough Java myself to do it, let us know if you need help and i would be happy to fiddle with it
    Support your right to arm bears.


    ^^This was the first video game which i played on an old win3.1 box

  5. #5
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    Thanks White_Eskimo, I just finished phase one. Our class uses JBuilder9. If anyone is trying this on your own my professor said that we needed to make a new project for each phase. Also for the user input, I'm using a package provided by my school called cs1.jar. If anyone wants it I can attach it here. To use it in JBuilder9 you would just go in the menu to Project>Project properties then go to the paths tab and at the bottom go to the required libraries tab. Then click on add and then click the new button at the bottom left. Then call it cs1 and click the add button to choose where the package is located. Then just click ok all the way out. Kindof complicated just to add a little package isn't it. Then to use it in the program you would first need this at the top:
    import cs1.*;
    Then in the program you could use:
    int n = Keyboard.readInt();
    or
    double n = Keyboard.readDouble();
    or
    String n = Keyboard.readString();

    So if anyone wants that package just say the word and I will attach it. It is pretty useful whether you are doing this project or not.

Posting Permissions

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