how to do this?
Type: Posts; User: dianac
how to do this?
package simulation;
import core.Direction;
/**
*
* Ant class
*
*
*/
package simulation;
import core.Direction;
/**
*
* Ant class
*
*
*/
Sorry, still in EAST:
The member enum EAST can only be defined inside a top-level class or interface
Syntax error, insert "EnumBody" to complete BlockStatements
package simulation;
import core.Direction;
/**
*
* Ant class
*
*
*/
It worked because I imported direction I suppose. That's why I don't understand. I have imported it as well in 24 and is showing error on EAST.
I am not sure. It is not showing any errors, but I did not run. It won't compile because it depends on Ant.java which is the one with this error on EAST
21 is in another class.
Here is the one the is not working:
package simulation;
import core.Direction;
/**
No need to answer my last question as I already imported Direction. I am trying to stub methods just to have the program running first. But I am having a problem.
package simulation;
import...
In:
public void executeStep() {
switch (originalDirection) {
case NORTH:
antcurrentI++;
break;
case SOUTH:
antcurrentJ++;
break;
public void executeStep() {
switch (originalDirection) {
case NORTH:
antcurrentI++;
break;
case SOUTH:
antcurrentJ++;
break;
case EAST:
antcurrentJ++;
Now I defined it at the class level:
public void executeStep() {
switch (originalDirection) {
case NORTH:
antrow=antcurrentI+1;
break;
case SOUTH:
antrow = antcurrentI-1;...
Thanks.
But how to set this variables to the ants new position.
to execute step i wrote:
public void executeStep() {
switch (originalDirection) {
case NORTH:
It could go Right, Left, Below and Up.
I know how to change rows and columns values, I just don't understan which variables refer to column and row in this code since I am supposed to follow what...
I have to fullfill with code a package called simulation with 3 classes. The first is in post 1
Tha seconde is
package simulation;
/**
The idea is that the ant is in a 2 dim array, but no array is declared
I don't understand this question:
Would a move be to an adjacent square?
Would there be 4 possible squares to move to...
I am starting with simulation on post 1, trying to do it by parts because I am really confused. I tried to write execute step, but I can't figure out how to make the ant move one step. I put switch...
This is the program
package langton;
import simulation.Ant;
import simulation.Grid;
import simulation.Simulation;
import core.Direction;
Sorry for the lack of information
The original position is 5,5
Direction is
package core;
public enum Direction {
NORTH, SOUTH, EAST, WEST;
Hi I am a begginner in java and have an assignment to simulate a Langton Ant. Would like some help where to start.
package simulation;
/**
*
* Simulation class
*