Skip to content

Commit ae8d339

Browse files
committed
Abstract animal class
1 parent 00aae15 commit ae8d339

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
# Ecosystem simulation project info
44
1. [Project info](#project-info)
5-
* [Technology](#technology)
6-
* [Aim](#aim)
5+
* [Technology](#technology)
6+
* [Aim](#aim)
77
2. [Board](#meadow-board)
8+
3. [Animals](#animals)
9+
* [General concept](#general-concept)
810

911
# Project info
1012

@@ -24,3 +26,22 @@ Board is 2 dimension matrix in Meadow class.
2426

2527
Info:
2628
* emoji: 🟩
29+
30+
31+
# Animals
32+
33+
## General concept
34+
35+
Animal - asbtract class for animals.
36+
37+
Properties:
38+
* timesAteToReproduce - how many times need to eat in order to reproduce
39+
* ate - how many times it ate without reproducing
40+
* endurance - how many rounds can go without eating before dying
41+
* health - currenct health level, if 0 - it dies
42+
43+
Methods:
44+
* reproduce - abstract reproduction which result is new Animal of the same type
45+
* eat - abstract eating method of some MeadowBoard object that should
46+
affect some other properties and may result in reproducing
47+

src/main/java/Animal.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public abstract class Animal {
2+
3+
int timesAteToReproduce;
4+
int ate;
5+
int endurance;
6+
int health;
7+
8+
public abstract Animal reproduce();
9+
public abstract boolean Eat(BoardMovement sth);
10+
}

0 commit comments

Comments
 (0)