public List<Command> getLegalCommands(Piece p) { LinkedList<Command> commands = new LinkedList<Command>(); for (Command c : p.getCommands()) { if (c.getCost() <= movesLeft) commands.add(c); } return commands; }
public List<Command> getLegalCommands() { LinkedList<Command> commands = new LinkedList<Command>(); for (Piece p : board.getPieces(faction)) { for (Command c : p.getCommands()) { if (c.getCost() <= movesLeft) commands.add(c); } } return commands; }