Hey gurus
![](smile.gif)
I''m writing a little chess program - bascially all I want to do is mess around with some AI and have a little fun.
I have the actual board and moves and even some simple AI working, but one thign is really stopping me from progressing.
My recursive algorithim basically does this:
1. Get the next legal move
2. Take a copy of the board
3. Do the move we got in #1
4. call this funtion recursively to a previously defined limit
5. Go back to 1
The problem is that I run out of memory before I can finish even a 2 ply ( basically 4 moves ) search!
At this point I''m quite happy with how fast it is searching, but the memory issue is really putting a damper on the whole thing
![](smile.gif)
Basically my board is a 8x8 array of ints with a class called moveList attached to it (to keep track of the game history) - now I can move the game history off of the board and into another class, but at this point it is basically empty anyway (since this is the first move of the game , and the MoveList class is basically a doubly linked class - very small to start)
So my questions are these:
1) Is there a way to force the Java VM to clean up memory? (It should do this automatically, but maybe it isn''t in the middle of a recursive call?)
2) My code to copy the board is like this:
public Object clone()
{
Board bCopy = new Board();
... double for loop to copy the int array
... copy a few other booleans..
}
- Is this costing me big time? Perhaps I''ve overloodek something major?
Your help is really appretiated! I''m really enjoying this program, and if anybody is really interested I can clean up the code and post it.
Thanks!
- Jim