Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Fixed bug in bear class
Browse files Browse the repository at this point in the history
  • Loading branch information
Spurberino committed Dec 20, 2023
1 parent 25baf6a commit 118f75b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/main/Animal.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public boolean food(World world) {
Eatable food = (Eatable) world.getTile(location);
if(hungerPlus(food.getEaten(biteSize, world)) > 0){
return true;
} else {
return false;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/Bear.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public void act(World world) {
return;
}
move(getRandomEmptySurroundingTile(world), world);
return;
}

// protect territory
Expand Down
1 change: 1 addition & 0 deletions src/main/Carcass.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public void act(World world) {
if (myFungus != null) {
world.setTile(deadLocation, myFungus);
}
return;
}

// Chance for a fungus to spawn inside the carcass
Expand Down
12 changes: 8 additions & 4 deletions src/test/test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
10
grass 1-1
18
grass 24
bear 1 (2,3)
wolf 1
wolf 3
carcass 1
carcass fungi 1
snake 1
snake 3
wolf 3
rabbit 16
berry 4

0 comments on commit 118f75b

Please sign in to comment.