# Please help me solve this problem, this is really urgent!

• April 1st, 2012, 01:05 PM
KalvinL7
Please help me solve this problem, this is really urgent!
Hey, can you please help me out, every time i try to run this code I get an error:
at players.K4LV1N.myMove(K4LV1N.java:115)
at players.K4LV1N.move(K4LV1N.java:86)"

Basically the move() method is called once every match by the SLArena and I am trying to store the moves in an array using the myMove() method.

The code is:
/**
* Returns the next move in the sequence to SLArena.
*/
public int move() {
myMove ();
if (++nextMove == LENGTH) {
nextMove = 0;
}
if (moves[nextMove] == ROCK) {
moves[nextMove] = PAPER;
return PAPER;
}
if (moves[nextMove] == PAPER) {
moves[nextMove] = SCISSORS;
return SCISSORS;
}
if (moves[nextMove] == SCISSORS) {
moves[nextMove + 1] = SPOCK;
return SPOCK;
}
if (moves[nextMove] == SPOCK) {
moves[nextMove] = LIZARD;
return LIZARD;
}
moves[nextMove] = ROCK;
return ROCK;
}

/**
* Stores my previous move.
*/
public void myMove () {
myMove[nextMove - 1] = this.move();
}
• April 1st, 2012, 02:54 PM
Norm
Re: Please help me solve this problem, this is really urgent!
Are the methods calling each other continually, recursively until the exception?
You will have to change the logic so they don't do that.
• April 1st, 2012, 02:55 PM
andreas90
Re: Please help me solve this problem, this is really urgent!
Quote:

Originally Posted by KalvinL7
Hey, can you please help me out, every time i try to run this code I get an error: