Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. package animal;
  2.  
  3. import java.util.Random;
  4.  
  5. public class Animal {
  6.    
  7.     protected final static Random RANDOM;
  8.     protected String signal;
  9.     protected boolean alive;
  10.     protected Position position;
  11.  
  12.     static{
  13.         RANDOM = new Random();
  14.     }
  15.    
  16.     public Animal(String signal, Position position) {
  17.         this.signal = signal;
  18.         this.position = position;
  19.         alive = true;
  20.     }
  21.  
  22.     public String getSignal() {
  23.         return signal;
  24.     }
  25.  
  26.     public boolean isAlive() {
  27.         return alive;
  28.     }
  29.  
  30.     public Position getPosition() {
  31.         return position;
  32.     }
  33.    
  34.     public void move(){
  35.     }
  36.    
  37.     public void eat(Animal food){
  38.         food.alive = false;
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement