Example #1
0
 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;
 }
Example #2
0
 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;
 }
Example #3
0
 public Collection getBestMoves() {
   AbstractMove high = findHighestScoringMove();
   return getMovesOfValue(high.getScore());
 }