package bagaturchess.bitboard.bughouse.eval;


import java.util.ArrayList;

public class BughouseDropPieceEval {

    /*
    EVALUATION used for drop pieces in minimax in
    PAWN / KNIGHT / BISHOP / ROOK / QUEEN
     */
    int[] BUGHOUSE_PIECE_EVAL = {
            100, 250, 225, 300, 400
    };

    int[] KING_DEFENSE_EVAL = {
            90, 275, 250, 300, 380
    };

    int[] BUGHOUSE_PIECE_EVAL_SUNSETTER = {
            100, 192, 195, 200, 390
    };

    int[] BUGHOUSE_PIECE_EVAL_SJENG = {
            100, 210, 230, 250, 450
    };

    int[] currentEval = BUGHOUSE_PIECE_EVAL.clone();

    public void setEval(String eval) {
        switch (eval) {
            case "class":
                currentEval = BUGHOUSE_PIECE_EVAL.clone();
            case "sun":
                currentEval = BUGHOUSE_PIECE_EVAL_SUNSETTER.clone();
            case "sjeng":
                currentEval = BUGHOUSE_PIECE_EVAL_SJENG.clone();
        }
    }


    private int getPieceEval(Character piece) throws UnsupportedOperationException {
       int res = 0;
       switch (piece) {
            case ('P'):
                res+=currentEval[0];
            case ('N'):
                res+=currentEval[1];
            case ('B'):
                res+=currentEval[2];
            case ('R'):
                res+=currentEval[3];
            case ('Q'):
                res+=currentEval[4];

           case ('p'):
               res-=currentEval[0];
           case ('n'):
               res-=currentEval[1];
           case ('b'):
               res-=currentEval[2];
           case ('r'):
               res-=currentEval[3];
           case ('q'):
               res-=currentEval[4];
       }
        return res;
    }


    public int getPiecesListEval(ArrayList<Character> pieces) {
        int res = 0;
        for (Character piece : pieces) {
            res += getPieceEval(piece);
        }
        return res;
    }

}
