@Override
    public Command read(Set<Command> availableCommands) {
        String commandString = null;
        while (true) {
            try {
                System.out.println("Choose one:");
                for (Command command : availableCommands) {
                    System.out.print(command.toString());
                    System.out.print(", ");
                }
                System.out.println();
                System.out.print("> ");

                commandString = stdin.readLine().trim();

                if (commandString != null) {
                    for (Command command : availableCommands) {
                        if (commandString.equals(command.getCommandString())) {
                            return command;
                        }
                    }
                    if (commandString.startsWith("l")) {
                        int number = Integer.parseInt(commandString.substring(1).trim());
                        return new ValueGameCommand<Integer>("l", number-1);
                    }
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }