private void createContent() { items.setSeed(rand.getSeed()); properties.setSeed(rand.getSeed()); while (content.size() < 100) { String property = properties.random(); String item = items.random(); String newItem = property + " " + item; if (!contains(newItem)) { int price = rand.nextInt(1, 50); price *= 5; put(newItem, price); } } }
public boolean canVend(int coins) { return content.get(0).cost <= coins; }
public Item random(int coins, Randomizer rand) { Integer max = itemsForCoins.get(coins); if (max == null) max = items.size() - 1; return content.get(rand.nextInt(0, max)); }
public int size() { return content.size(); }
public void put(String name, int cost) { content.add(new Item(name, cost)); }