private void GenerateTasks(int level, int[][] ResM) { Point AbleForGo[] = new Point[4 * sizeBoard]; int cntAbleForGo = board.getAbleForGo(idAuto, AbleForGo); // PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); // out.print("Point: size:"); out.println(cntAbleForGo); for (int i = 0; i < cntAbleForGo; ++i) { // out.print("x:"); out.print(AbleForGo[i].x); // out.print(" y:"); out.println(AbleForGo[i].y); mt.addTask(new Task(level, board, idAuto, idUser, AbleForGo[i], ResM)); } // out.flush(); }
private int SearchForAll(int level, int id1, int id2) { Board board = boards[level]; Board newBoard = boards[level - 1]; int res = Integer.MIN_VALUE; Point AbleForGo[] = new Point[4 * size]; int cntAbleForGo = board.getAbleForGo(id1, AbleForGo); int cntOldForID1 = board.getCount(id1); for (int i = 0; i < cntAbleForGo; ++i) { Point newPos = AbleForGo[i]; newBoard.setAs(board); newBoard.go(id1, newPos); int cntNewForID1 = newBoard.getCount(id1); int newRes = cntNewForID1 - cntOldForID1; if (level > 1) newRes -= this.SearchForAll(level - 1, id2, id1); if (newRes > res) res = newRes; } return res; }
public Vector<Point> getAbleForUser() { return board.getAbleForGo(playerGamer.getId()); }