This forum is in permanent archive mode. Our new active community can be found here.

Weekend coding

1568101139

Comments

  • It looks like it can't find any of the modules. I'm guessing it's my classpath or something.GravityApplet.java:74: cannot find symbol
    symbol : constructor Vector(double,double)
    location: class java.util.Vector
    position[i] = new Vector(dim.width*(.5*generator.nextDou
    ble()+ .25), dim.height*(.5*generator.nextDouble()+ .25));
    ^
    GravityApplet.java:75: cannot find symbol
    symbol : constructor Vector(double,double)
    location: class java.util.Vector
    velocity[i] = new Vector(sigmav*generator.nextGaussian()
    , sigmav*generator.nextGaussian());
    ^
    GravityApplet.java:86: cannot find symbol
    symbol : method multiply(double)
    location: class java.util.Vector
    netMomentum = netMomentum.add(velocity[i].multiply(mass[
    i]));
    ^
    GravityApplet.java:93: cannot find symbol
    symbol : method multiply(double)
    location: class java.util.Vector
    Vector netVelocity = netMomentum.multiply(inverseTotalMass);
    ^
    GravityApplet.java:98: cannot find symbol
    symbol : method subtract(java.util.Vector)
    location: class java.util.Vector
    velocity[i]=velocity[i].subtract(netVelocity);
    ^
    GravityApplet.java:122: cannot find symbol
    symbol : method x()
    location: class java.util.Vector
    bufferGraphics.fillRect((int) (position[i].x() - 1), (int) (posi
    tion[i].y() - 1), 2, 2);
    ^
    GravityApplet.java:122: cannot find symbol
    symbol : method y()
    location: class java.util.Vector
    bufferGraphics.fillRect((int) (position[i].x() - 1), (int) (posi
    tion[i].y() - 1), 2, 2);

    ^
    GravityApplet.java:137: cannot find symbol
    symbol : method x()
    location: class java.util.Vector
    bufferGraphics.fillRect((int) (center.x() - 1), (int) (center.y(
    ) - 1), 2, 2);
    ^
    GravityApplet.java:137: cannot find symbol
    symbol : method y()
    location: class java.util.Vector
    bufferGraphics.fillRect((int) (center.x() - 1), (int) (center.y(
    ) - 1), 2, 2);
    ^
    GravityApplet.java:170: cannot find symbol
    symbol : method subtract(java.util.Vector)
    location: class java.util.Vector
    radius = (position[i].subtract(position[j]));
    ^
    GravityApplet.java:171: cannot find symbol
    symbol : method dot(java.util.Vector)
    location: class java.util.Vector
    divisor = radius.dot(radius);
    ^
    GravityApplet.java:172: cannot find symbol
    symbol : method multiply(double)
    location: class java.util.Vector
    force[i][j] = radius.multiply(-g*mass[i]*mass[j]
    /divisor);
    ^
    GravityApplet.java:173: cannot find symbol
    symbol : method negative()
    location: class java.util.Vector
    force[j][i] = force[i][j].negative();
    ^
    GravityApplet.java:189: incompatible types
    found : boolean
    required: java.util.Vector
    netForce[i] = netForce[i].add(force[i][j]);
    ^
    GravityApplet.java:196: cannot find symbol
    symbol : method multiply(double)
    location: class java.util.Vector
    acceleration[i] = netForce[i].multiply(inverseMass[i]);
    ^
    GravityApplet.java:202: cannot find symbol
    symbol : method multiply(double)
    location: class java.util.Vector
    position[i]=position[i].add(velocity[i].multiply(dt));
    ^
    GravityApplet.java:203: cannot find symbol
    symbol : method multiply(double)
    location: class java.util.Vector
    velocity[i]=velocity[i].add(acceleration[i].multiply(dt));
    ^
    GravityApplet.java:220: cannot find symbol
    symbol : method multiply(double)
    location: class java.util.Vector
    massPosition = massPosition.add(position[i].multiply(mas
    s[i]));
    ^
    GravityApplet.java:224: cannot find symbol
    symbol : method multiply(double)
    location: class java.util.Vector
    center = massPosition.multiply(inverseTotalMass);
    ^
    Note: GravityApplet.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    19 errors
  • You appear to be running the old versions that use doubles, right now I have backed off to floats so that I can simulate more objects. A;though it is strange that the old version isn't working, you want to skype me so we can get a better grasp on the problem?
  • Yes, I'm using the double version. I don't think it's anything on your end. I'll just google around and see why java can't access the vector module.
  • Yes, I'm using the double version. I don't think it's anything on your end. I'll just google around and see why java can't access the vector module.
    Should I put the entire project in a zip and send it to you?
  • edited April 2011
    I'm not sure if that would help. Every error is related to java.util.Vector. I think I just have to find a working copy of that somehow. Maybe I should reinstall jdk?
    Post edited by Pegu on
  • Well, I provided you with a copy, my Vector package is most likely different from java's as I coded it specifically for this project.
  • Oh. Where is your vector package?
  • edited April 2011
    I updated it to use floats instead of doubles, so I did. Right now I am running a simulation with 120 objects. It looks pretty good.
    Gravity Applet (float)
    Vector Object (float)

    Okay, this is getting an argument out of bounds every time I start it with a large number of objects. Does this have anything to do with me running out of memory?

    EDIT: I made it reinitialize the counter variables each time and that has cleared up most of the errors. I also made it so that if any two masses occupy the same space that the force exerted is zero.
    It's right there in my post. Technically it's not a package... but it is part of the GravityApplet package.

    EDIT: I am currently running the Applet with 1000 objects, feels good man.
    Post edited by GreyHuge on
  • Oh, silly me. I thought that was a separate program for simulating vectors or something. As usual, I've embarrassed myself by being an idiot.
  • Oh, silly me. I thought that was a separate program for simulating vectors or something. As usual, I've embarrassed myself by being an idiot.
    Oh, don't worry about it. So how does it look?
  • At the risk of looking stupider, now I'm getting this error(after getting another one that was a compiler glitch):Exception in thread "main" java.lang.NoClassDefFoundError: GravityApplet (wrong name: GravityApplet/GravityApplet)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    Could not find the main class: GravityApplet. Program will exit.
  • edited April 2011
    What sort of IDE are you using? I am currently using eclipse to compile and run my code, my friend is having similar problems. So he's downloading it.
    Post edited by GreyHuge on
  • I'm actually just using the command line. Maybe Eclipse is creating some other files the project needs?
  • I got it working in Eclipse.
  • edited April 2011
    I got it working in Eclipse.
    Excellent, sorry for my absence, do you have any recommendations about how to code it better?

    Also, new version:
    Gravity Applet 1.0
    Vector Object 1.0
    Post edited by GreyHuge on
  • Voxels, marching cubes tesselation, and noise functions are fun

    (full disclosure, you'll have to install the Unity browser plugin if you haven't already to see the above)
  • edited April 2011
    That looks pretty good, what are you going to use it for?

    Also, I'm having problems with collision, is anyone an expert on this topic?
    Post edited by GreyHuge on
  • That looks pretty good, what are you going to use it for?

    Also, I'm having problems with collision, is anyone an expert on this topic?
    Delete the semicolon after your if statement.
  • edited April 2011
    Delete the semicolon after your if statement.
    I KNOW MAN, THAT FUCKING SEMICOLON.

    EDIT: From now on, new versions of this Applet can be found at my pastebin until I figure out how to embed an applet in a webpage and then find someplace to host it. (If you have any recommendations about this, then please post them)
    Also, something I am not sure about, is anyone actually interested in this program? Because I could really use some help deciding what to do next, and no one is discussing it in any capacity.
    Post edited by GreyHuge on
  • Would anyone be interested in a possible forum coding club competition?
    Also,
    image
  • Would anyone be interested in a possible forum coding club competition?
    I would be, though it depends a little on the nature of the competition.
  • I would be, though it depends a little on the nature of the competition.
    WHO CAN MAKE THE SUPREME DEFCON AI?!?
  • I haven't played Defcon, but that could be a good competition. However, the best answer could involve significant copy-pasting from the Internet as this seems like an already well-established challenge.
  • Right now I want to pick up a new language over the summer, but I'm not sure what to learn. The only language I really know is Java. I like it a lot, but I don't want to put more time into learning it now, because I'm taking AP Comp Sci next year, which covers Java, so that whole class would become a waste.

    Any suggestions?
  • Any suggestions?
    Python.
  • People, if you are asking "what language" you are asking the wrong question. Learn to program, period.

    You don't learn a Ford Mustang. You learn to drive. Then you are able to drive any car. Learn to program, and then you will be able to use any language. People who learn a language, as opposed to learning how to program, often get stuck where they can't learn other tools easily.

    It really doesn't matter what language you choose. You can learn fundamental concepts even using languages that aren't popular in the real world. The people like me who are programmers now didn't learn with the languages we use every day. We learned with languages like BASIC or LOGO that are hardly used for real work.
  • True... Once you learn how to program, you can more or less become reasonably proficient in any reasonable language in a week or two, if that.

    Though if you really want a challenge, oh, try teaching yourself befunge or something over the summer. :)
  • If you want something that's interesting try a functional language like Haskell. It took me a while to get my head around what-the-hell was going on there. I was quite impressed with process however. Programming in a functional language was different enough from OOP or top down that it really did require a bit of effort to get into the groove of it.
  • So I have a request for a simple program which is of the scale that it could be done in a weekend. The input would be a series of arithmetic identities, and it would state which of do not fulfill both of the following two properties.

    1) The two sides are equal.
    2) The digits 1,2,3,4 and 5 are each used exactly once.

    The list of identities I want to be checked can be found here:
  • Not doing your homework for you.
Sign In or Register to comment.