We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Jeroo j;
public class Jeroo{
int r,c,numFlowers,d;
//dir 1=w 2=a 3=s 4=d
boolean isMoving;
public Jeroo(int row,int col,int numFlows){
r=row;
c=col;
numFlowers=numFlows;
d=1;
}
void hop(){ //moves based on direction
if(d==1)
r=r+1;
else if(d==2)
c=c-1;
else if(d==3)
r=r-1;
else if(d==4)
c=c+1;
if(d>4||d<=0)
d=1;
println(r+", "+c+" direction is "+d);
}
void hop(int numSpaces){ //hops the num spaces based on dir
for(int i=0;i<numSpaces;i++){
hop();
println(i);
}
}
int getR(){return r;}
int getC(){return c;}
int getD(){return d;}
void setR(int row){r=row;}
void setC(int col){c=col;}
void turn(int dir){
d=dir;
if(d>4||d<=0)
d=1;
println(r+", "+c+" direction is "+d);
}
boolean isFacing(int compdir){if(d==compdir){return true;}else{return false;}}
boolean hasFlower(){if(numFlowers>0){return true;}else{return false;}}
void plant(){
if(hasFlower()){
//Flower f=new Flower(r,c);
}
}
void toss(){
if(hasFlower())
{
numFlowers--;
println(numFlowers);
}
else{
println("ERROR NO FLOWERS LEFT");
}
}
//void pick(){}
}
void setup(){ //insert all move commands here
j=new Jeroo(4,4,4);
size(200,200);
j.hop(4);
j.turn(0);
j.turn(1);
j.turn(2);
j.turn(3);
j.turn(4);
j.turn(5);
println(j.isFacing(1));
println(j.hasFlower());
j.toss();
j.toss();
j.toss();
j.toss();
j.toss();
}
void draw(){ //draw graph and the jeroo
}
edit: just an error copied and pasted to new window and it fixed