I have an ArrayList of the following type:
class Move
{
int from, to;
}
The from property always has a value. The to property will have -1 if it is not set. I have the following array:
int[][] history = new int[50][50];
where the dimensions correspond to the 'from' and 'to' of the move class. In my search function, and depending on certain conditions I need to do:
List<move> moves = board.getMoves();
for (int i = 0; i < moves.size(); i++)
history[move.from][move.to]++;
Because move.to could also be -1, should I increase the dimension of the 2d array 1 and then do:
history[move.from+1][move.to+]++;
Also, based on the above move list and history array, I need to sort the move list in descending order depending on the counter of the corresponding history index.
Is this possible?