Пример #1
0
 static void move(Robot r, Player p) throws Exception {
   Board b = BoardReader.read(r);
   final Piece next =
       NextPiece.readNextPiece(r.createScreenCapture(new Rectangle(NPX, NPY, 256, 256)));
   List<Pair<Move, Board>> moves = PiecePlacements.moves(b);
   if (moves == null) return;
   Collections.sort(
       moves,
       new Comparator<Pair<Move, Board>>() {
         public int compare(Pair<Move, Board> a, Pair<Move, Board> b) {
           return MoveEvaluator.score(b.second, next) - MoveEvaluator.score(a.second, next);
         }
       });
   p.play(moves.get(0).first);
 }