package me.alexqq11;

import java.util.LinkedList;

/**
 * Created by Alexqq11 on 21.09.2016.
 */
public class Snake extends Essence {
    private GameEngine engine;
    private int lives;
    private int length;
    private boolean alive;
    private LinkedList<SnakePart> snakeParts;
    private EssenceConfig snakeConfig;

    private void updateSnakeSegment() {
        if (!this.positionEquals(this.snakeParts.getFirst())) {
            snakeParts.addFirst(new SnakePart(this));
            snakeParts.pollLast() /?
        }
    }

    public void moveTo(SnakeDirections direction){
        if (direction == SnakeDirections.UP)
            this.y+=1;
            this.updateSnakeSegment();
        // TODO MAKE SWITH HERE
    }
    public void checkSelf() {
     // TODO MAKE cheking alive snake;
    }
    public void EngineSignalReceiver(EngineSignals signal){
        //TODO engine signal handler for esenses !!!  like die signal
    }
    public int getLives(){
        return this.lives;
    }
    public int getLength(){
        return this.length;
    }
    public boolean isAlive(){
        return this.alive;
    }
    public LinkedList<SnakePart> getSnakePosition(){
        return this.snakeParts;
    }
}


@@ -198,23 +198,39 @@
 ate int 
-length;
+size; // length =%3E size
 %0A    pri
@@ -242,22 +242,44 @@
 boolean 
-a
+isA
 live;
+ // alive =%3E isAlive
 %0A    pri
@@ -687,10 +687,12 @@
 is.y
+ 
 +=
+ 
 1;%0A 
@@ -1086,22 +1086,20 @@
 rn this.
-length
+size
 ;%0A    %7D%0A
@@ -1148,17 +1148,19 @@
 rn this.
-a
+isA
 live;%0A  

Update Snake.java