* agent.
*/
@Override
public void prepare(String changedSelector) {
AgentAppFrame.SelectionState selState = frame.getSelection();
EightPuzzleBoard board = null;
switch (selState.getValue(EightPuzzleFrame.ENV_SEL)) {
case 0: // three moves
board = new EightPuzzleBoard(new int[] { 1, 2, 5, 3, 4, 0, 6,
7, 8 });
break;
case 1: // medium
board = new EightPuzzleBoard(new int[] { 1, 4, 2, 7, 5, 8, 3,
0, 6 });
break;
case 2: // extreme
board = new EightPuzzleBoard(new int[] { 0, 8, 7, 6, 5, 4, 3,
2, 1 });
break;
case 3: // random
board = new EightPuzzleBoard(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8});
Random r = new Random(System.currentTimeMillis());
for (int i = 0; i < 200 ; i++) {
switch (r.nextInt(4)) {
case 0: board.moveGapUp(); break;
case 1: board.moveGapDown(); break;
case 2: board.moveGapLeft(); break;
case 3: board.moveGapRight(); break;
}
}
}
env = new EightPuzzleEnvironment(board);
agent = null;