-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPopulation.java
More file actions
41 lines (28 loc) · 855 Bytes
/
Copy pathPopulation.java
File metadata and controls
41 lines (28 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package Evolution;
import java.util.ArrayList;
import java.util.Stack;
import javafx.scene.layout.Pane;
public class Population{
private ArrayList <Bird> _livebirds;
private Stack <Bird> _deadbirds;
public Population() {
_deadbirds= new Stack<Bird>();
}
//this method initializes 50 birds as the population and adds them to the arraylist of live birds
public void createBirds(Pane _gamepane) {
_livebirds = new ArrayList<Bird>(50);
for (int i = 0; i<50; i++) {
Bird bird = new Bird();
_livebirds.add(i,bird);
_gamepane.getChildren().add(_livebirds.get(i).getBirdshape());
}
}
//this method returns the arraylist of live birds
public ArrayList<Bird> getLiveBirds() {
return _livebirds;
}
//this method returns the stack of dead birds
public Stack<Bird> getDeadBirds(){
return _deadbirds;
}
}