Hello,
I know this is a popular problem with a lot of solutions, but I don't want to be pointed to a post by someone else with THEIR solution. I want to figure out how to make my own code work. So, any help you could provide would be wonderful!
So, what I'm trying to do is solve the Knight's Tour problem (without a GUI) and print the result as follows:
Now, of course this is not the correct answer since...
User Profile
Collapse
-
Knight's Tour Project
-
Yes, I see that. I actually caught that mistake minutes before I read your post. :) Thank you so much for the help though. Your advice on the toroidal structure was very useful. Much thanks. -
Game of Life. I've isolated where the problem is
So, I've been working on this Game of Life (http://www.bitstorm.or g/gameoflife/) project, and all the code has been written. However, it will not run. First, I will post the error message and the fragment of code I think to be the cause of the problem. Then, I will post the code to all 3 of my java files in their entirety should you wish to reference them. Any help would be much appreciated.
Also, if it would help fix my error,... -
NOTE: this is not a homework assignment for a grade. It is simply a problem my teacher has given my class to as optional review. So, helping me figure out were I went wrong would allow me to further my currently limited knowledge of Java.
Again, if anyone is willing to help me find the error in my program that leads to this incorrect output, that would be much appreciated! Thanks again.
I have traced through my...Leave a comment:
-
CountWords Assn.
I would greatly appreciate it if any one of you kind souls could take some time to help me out with an interesting bug in my program. I have tried many times to find the source of the problem unsuccessfully and believe that a second set of eyes will do wonders. Thanks in advance for reading my post.
*************** *************** ***
So, after quite some work, I was able to get this program to run (I am a bit of a... -
BUMP. I still need help getting the step values correct for each sorting algorithm.Leave a comment:
-
UPDATE: I made a bad typo that prevented the program from running in the first place. I have that resolved now. Line 41's list.get(temp) should read simply "temp"
HOWEVER! I would still like you guys to assess my += operations on the steps variable to see if I have the correct values being added. I would like to compare the number of steps necessary for each sorting algorithm across the board. Thanks!Leave a comment:
-
I also have a more specific question regarding my use of the variable STEPS to count how many comparisons, gets, and sets are made for each of the three sorting algorithms in this program. Are my values for "STEPS += ??" correct? If not, what should they be and why?Leave a comment:
-
Quadratic Sorting Algorithm Program
Hello! I need help with a program that I believe I am nearly done with. However, there seems to be a few details that preclude me from success. Here is my assignment:
Here is my class file (Sorts.java):
Code:import java.util.*; /** * Description of Class * * @author Blake Walsh * @created October 20, 2009 */ public class Sorts{
-
Thank you so much!! The program runs correctly now, with the exception of the area calculation...c ould you take a look at that algorithm for me?
Here's what it actually is:
0.5(X0*Y1 + X1*Y2 + ... + XN-1*Y0 - Y0*X1 - Y1*X2 - ... - YN-1*X0)
Can you check my area() method to see what might be giving me the incorrect output? I can't quite see what's wrong...maybe another set of eyes will help.
Here's...Last edited by Frinavale; Oct 15 '09, 03:27 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.Leave a comment:
-
So, I redid the IrregularPolygo n Class, and here's the new error message I got:
Enter another point? (Y/N)Exception in thread "main" java.lang.Index OutOfBoundsExce ption: Index: 1, Size: 1
at java.util.Array List.RangeCheck (Unknown Source)
at java.util.Array List.get(Unknow n Source)
at IrregularPolygo n.perimeter(Irr egularPolygon.j ava:47)
at IrregularPolygo nTester.main(Ir regularPolygonT ester.java:27)...Last edited by Frinavale; Oct 15 '09, 03:27 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.Leave a comment:
-
Sorry, but that didn't help much - even though I've spent the last hour or so working on this problem. I'm still quite new to Java, so a more thorough explanation of what it is I need to do would be much appreciated!Leave a comment:
-
Isn't this the ArrayList to which myPolygon refers?
ArrayList <Point2D.Double > myPolygon = new ArrayList <Point2D.Double >();Leave a comment:
-
I'm not sure I quite understand the nature of this problem or how to go about resolving it. Why does it matter if the myPolygon ArrayList is null (aka empty) if I add values to it (make it NOT null) before I try to do anything else with it? Have you been able to get this code to work?
Again, I really appreciate all of your help!Leave a comment:
-
Thank you for your reply! - still need help though!
The program does compile, but something seems to be going on with the line I indicated in my code as well as in the toAdd method in the non-tester file.
Here is the error message I keep receiving:
Enter X-Coordinate: 3
Enter Y-Coordinate: 4
Exception in thread "main" java.lang.NullP ointerException
at IrregularPolygo n.toAdd(Irregul arPolygon.java: 28)...Leave a comment:
-
Irregular Polygon Program
Here is my assignment that I need help with:
1. Implement a class IrregularPolygo n that contains an array list of Point2D.Double objects.
2. The Point2D.Double class defines a point specified in double precision representing a location in (x, y) coordinate space. For example, Point2D.Double( 2.5, 3.1) constructs and initializes a point at coordinates (2.5, 3.1).
3. Use the following declarations as a starting point...Last edited by Frinavale; Oct 15 '09, 03:25 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.
No activity results to display
Show More
Leave a comment: