This commit is contained in:
2025-02-25 13:13:28 +01:00
parent f175e8a91d
commit f8f73925e3
2 changed files with 5 additions and 5 deletions

View File

@@ -1,6 +1,5 @@
package de.szut.zuul; package de.szut.zuul;
import java.sql.SQLOutput;
import java.util.Random; import java.util.Random;
/** /**
@@ -68,7 +67,7 @@ public class Game
// add muffins to random rooms // add muffins to random rooms
Room[] rooms = {marketsquare, templePyramid, tavern, sacrificialSite, hut, jungle, secretPassage, cave, beach, basement, wizardsRoom}; Room[] rooms = {marketsquare, templePyramid, tavern, sacrificialSite, hut, jungle, secretPassage, cave, beach, basement, wizardsRoom};
Random random = new Random(); Random random = new Random();
for (int i = 0; i < 3; i++) { // Add 3 muffins to random rooms for (int i = 0; i < 3; i++) {
int randomIndex = random.nextInt(rooms.length); int randomIndex = random.nextInt(rooms.length);
rooms[randomIndex].putItem(new Item("Muffin", "a delicious muffin", 0.2)); rooms[randomIndex].putItem(new Item("Muffin", "a delicious muffin", 0.2));
} }
@@ -113,7 +112,9 @@ public class Game
} }
/** /**
* Main play routine. Loops until end of play. * Main play routine. Loops until end of play.
*
* @return
*/ */
public void play() public void play()
{ {

View File

@@ -43,9 +43,8 @@ public class Player {
public double getLoadCapacity() { public double getLoadCapacity() {
return loadCapacity; return loadCapacity;
} }
public double eatMuffin() { public void eatMuffin() {
loadCapacity += new Random().nextInt(11); loadCapacity += new Random().nextInt(11);
return loadCapacity;
} }
private double calculateWeight() { private double calculateWeight() {