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