コード例 #1
0
ファイル: MoveFinder.java プロジェクト: slagyr/chess
 private AbstractMove findHighestScoringMove() {
   AbstractMove bestMove = new IllegalMove();
   for (Iterator i = itsMoves.iterator(); i.hasNext(); ) {
     AbstractMove move = (AbstractMove) i.next();
     if (move.getScore() > bestMove.getScore()) bestMove = move;
   }
   return bestMove;
 }
コード例 #2
0
ファイル: MoveFinder.java プロジェクト: slagyr/chess
 private Collection getMovesOfValue(int target) {
   Collection moves = new HashSet();
   for (Iterator i = itsMoves.iterator(); i.hasNext(); ) {
     AbstractMove move = (AbstractMove) i.next();
     if (move.getScore() == target) moves.add(move);
   }
   return moves;
 }
コード例 #3
0
ファイル: MoveFinder.java プロジェクト: slagyr/chess
 public Collection getBestMoves() {
   AbstractMove high = findHighestScoringMove();
   return getMovesOfValue(high.getScore());
 }