package de.htw_berlin.HoboOthello.core;


/**
 * Created by laura on 17.11.16.
 */
public class Field {

    private boolean empty;
    private boolean white;
    private boolean black;

    /**
     * set an empty field
     */
    public Field() {
        setEmpty();
    }

    public Field(boolean empty, boolean white, boolean black) {
        int tmp = 0;

        if (empty) {
            tmp++;
            setEmpty();
        }

        if (white) {
            tmp++;
            setWhite();
        }

        if (black) {
            tmp++;
            setBlack();
        }

        //todo show warning if (0 == tmp || tmp > 1)
    }

    /**
     * Add an field with just one possible condition
     * b == Black
     * w == White
     * everything else == empty
     *
     * @param FieldState b for Black field
     *                   w for White field
     *                   e for empty field
     */
    public Field(char FieldState) {
        switch (FieldState) {
            case 'b':
                setBlack();
                break;
            case 'w':
                setWhite();
                break;
            default:
                setEmpty();
        }
    }

    public boolean possibleForActualPlayer() {
        //Methode selbst muss noch geschrieben werden, return true if possible, false if not
        //hierfür brauche wir implentierte Spielregeln
        return true;
    }

    //getter und setter schon mal bereitgestellt, werden noch nicht benutzt!
    public boolean isEmpty() {
        return this.empty;
    }

    public boolean isWhite() {
        return this.white;
    }

    public boolean isBlack() {
        return this.black;
    }

    /**
     * show the current field state as an String
     *
     * @return the current field state "empty", "white", "black"
     */
    @Override
    public String toString() {
        if (this.empty) {
            return "empty";
        } else if (this.white) {
            return "white";
        } else {
            return "black";
        }
    }

    public void setEmpty() {
        this.empty = true;
        this.white = false;
        this.black = false;
    }

    public void setWhite() {
        this.empty = false;
        this.white = true;
        this.black = false;
    }

    public void setBlack() {
        this.empty = false;
        this.white = false;
        this.black = true;
    }
}

@@ -178,16 +178,61 @@
 n black;
+%0A    private boolean possibleForActualPlayer;
 %0A%0A    /*
@@ -1260,183 +1260,149 @@
 ean 
-possibleForActualPlayer() %7B%0A        //Methode selbst muss noch geschrieben werden, return true if possible, false if not
+isEmpty() %7B%0A        return this.empty;%0A    %7D%0A%0A    public boolean isWhite() %7B%0A        return this.white;
 %0A    
+%7D%0A%0A
     
-//hierf%C3%BCr brauche wir implentierte Spielregeln
+public boolean isBlack() %7B
 %0A   
@@ -1414,19 +1414,25 @@
 return t
-rue
+his.black
 ;%0A    %7D%0A
@@ -1440,108 +1440,59 @@
     
-//getter und setter schon mal bereitgestellt, werden noch nicht benutzt!%0A    public boolean isE
+public char isFieldState() %7B%0A        if (this.e
 mpty
-(
 ) %7B%0A
@@ -1503,65 +1503,61 @@
     
+ 
+   
 return 
-this.empty
+'e'
 ;%0A    
-%7D%0A%0A
     
-public boolean isW
+%7D else if (this.w
 hite
-(
 ) %7B%0A
+    
     
@@ -1571,55 +1571,27 @@
 urn 
-this.white
+'w'
 ;%0A    
-%7D%0A%0A
     
-public boolean isBlack()
+%7D else
  %7B%0A 
@@ -1597,34 +1597,41 @@
         
+    
 return 
-this.black;
+'b';%0A        %7D
 %0A    %7D%0A%0A
@@ -2344,11 +2344,256 @@
 e;%0A    %7D
+%0A%0A    public boolean isPossibleForActualPlayer() %7B%0A        return possibleForActualPlayer;%0A    %7D%0A%0A    public void setPossibleForActualPlayer(boolean possibleForActualPlayer) %7B%0A        this.possibleForActualPlayer = possibleForActualPlayer;%0A    %7D
 %0A%7D%0A

add state possibleForActualPlayer