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?
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?
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.
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.
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.
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.
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.
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:
Comments
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
EDIT: I am currently running the Applet with 1000 objects, feels good man.
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.
Also, new version:
Gravity Applet 1.0
Vector Object 1.0
(full disclosure, you'll have to install the Unity browser plugin if you haven't already to see the above)
Also, I'm having problems with collision, is anyone an expert on this topic?
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.
Also,
Any suggestions?
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.
Though if you really want a challenge, oh, try teaching yourself befunge or something over the summer.
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: