Example #1
0
 public ArrayList<Piece> getListByColor(Color color) {
   ArrayList<Piece> piecesList = new ArrayList<Piece>();
   for (Piece piece : row) {
     if (piece.getColor() == color) piecesList.add(piece);
   }
   return piecesList;
 }
Example #2
0
 private String shortName(Piece p) {
   if (p == null) {
     return "";
   }
   String ret = "" + p.getColor().toString().charAt(0);
   Type t = p.getType();
   switch (t) {
     case PAWN:
       ret += "P";
       break;
     case ROOK:
       ret += "R";
       break;
     case KNIGHT:
       ret += "N";
       break;
     case BISHOP:
       ret += "B";
       break;
     case QUEEN:
       ret += "Q";
       break;
     case KING:
       ret += "K";
       break;
   }
   return ret;
 }
Example #3
0
 public double getScoreFromRow(Color color) {
   double score = 0;
   for (Piece piece : row) {
     if (piece.getColor() == color) {
       score += piece.getScore();
     }
   }
   return score;
 }