Example #1
0
  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;
  }
Example #2
0
  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;
  }