There is something messed up in the way this project is configured in the IDE. I've never seen the error message that is being posted. The error message doesn't correspond to the posted source code....
Type: Posts; User: Norm
There is something messed up in the way this project is configured in the IDE. I've never seen the error message that is being posted. The error message doesn't correspond to the posted source code....
You posted the enum definition in post#3. Did you ever use it in any of the code after that without any problems? If it did work for some classes since post #3, what has changed since then?
try Direction.EAST
Sorry, I can't connect that post with any code. Where is the code causing the error?
Copy the full text of the error messages and paste it here.
Please explain. Copy the full text of the error messages and paste it here.
Ant is not coded correctly now. That should be fixed.
Change the code to return the correct value vs EAST.
Suggestion: add a main() method for testing the constructor and methods. Create an instance of the Ant class, call its methods and print out...
The question was, how did code in post#21 work without an error when it referenced EAST.
If EAST worked in post#21, what is different in the code in post#22.
What should the getDirection() method return? Why always EAST?
Suggestion: add a main() method for testing the...
Do it where the execution starts, like in the constructor.
Do you live south of the equator and orient your maps with the South pole at the top?
The case statements should update the current position. What's coded in the case statements doesn't change the current row. The moves should change the current position by 1 in the appropriate...
You can't always use the start position to determine the next position. You need to use the current position.
int antrow=antStartI+1;
The current position variables need to be defined at the...
Those variables name have "Start" in them which could mean that they are the initial values and would not be used to keep track of the ant's current location which could be kept in variables: antRow...
What is the current problem you are working on? Ask a specific question.
Have you done any analysis of the problem and written a list of the steps the program needs to do to solve the problem? What...
I assume the ant is located in a square at a row and column in an array.
I was asking what squares are adjacent to a given square? Just the 4 that are above, right, below and left of the current...
Is the ant in a 2 dim array of sqaures?
Would a move be to an adjacent square?
Would there be 4 possible squares to move to (barring a current location at an edge which would reduce the possible...
What are your problems with the posted code? Do you have any specific questions?
Ok, now what should the program do?
Can you explain? What is its position: x,y?
What is its direction: north, east, south, west?
For example: If the ant is at x,y and it is facing east, what should happen?