Beispiel #1
0
 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);
     }
   }
 }
Beispiel #2
0
 public boolean canVend(int coins) {
   return content.get(0).cost <= coins;
 }
Beispiel #3
0
 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));
 }
Beispiel #4
0
 public int size() {
   return content.size();
 }
Beispiel #5
0
 public void put(String name, int cost) {
   content.add(new Item(name, cost));
 }