text: #include "PBishop.h"
  #include "../CPipe.h"
  #include "../CPos.h"
  
  CPiece* PBishop::clone(CPos *positionI) {
    CPiece* clone = new PBishop(this->color, positionI);
  
    return clone;
  }
  
  PBishop::PBishop(bool colorI, CPos *currentPosition)
  {
      //ctor
      color = colorI;
      pos = currentPosition;
      if (color) { //if the piece is white, give it a white FEN-Name
        fenType = 'B';
      } else {
        fenType = 'b';
      }
  }
  
  PBishop::~PBishop()
  {
      //dtor
  }
  
  
  
  std::vector<std::string> PBishop::getMoves() {
    tempMoves.clear();
  
    bool collided = false;
    int relPosX = cordX; // where the move generator currently is.
    int relPosY = cordY;
    //four directions
    //top-left:
    while (collided == false) {
      relPosY +=1;
      relPosX -= 1;
      if (squareAvailable (relPosX, relPosY)) {
        tempMoves.push_back (CPos::getSquareName (cordX, cordY) + CPos::getSquareName(relPosX, relPosY));
      } else {
        collided = true; // just trying to go out the way of ANOTHER break
      }
    }
    collided = false;
    relPosY = cordY;
    relPosX = cordX;
      //top-right:
    while (collided == false) {
      relPosY +=1;
      relPosX += 1;
  
      if (squareAvailable (relPosX, relPosY)) {
        tempMoves.push_back (CPos::getSquareName (cordX, cordY) + CPos::getSquareName(relPosX, relPosY));
      } else {
        collided = true; // just trying to go out the way of ANOTHER break xD
      }
    }
    collided = false;
    relPosY = cordY;
    relPosX = cordX;
      //bottom-right:
    while (collided == false) {
      relPosX += 1;
      relPosY -= 1;
      if (squareAvailable (relPosX, relPosY)) {
        tempMoves.push_back (CPos::getSquareName (cordX, cordY) + CPos::getSquareName(relPosX, relPosY));
      } else {
        collided = true; // just trying to go out the way of ANOTHER break xD
      }
    }
    collided = false;
    relPosY = cordY;
    relPosX = cordX;
      //bottom-left:
    while (collided == false) {
      relPosY -=1;
      relPosX -= 1;
      if (squareAvailable (relPosX, relPosY)) {
        tempMoves.push_back (CPos::getSquareName (cordX, cordY) + CPos::getSquareName(relPosX, relPosY));
      } else {
        collided = true; // just trying to go out the way of ANOTHER break xD
      }
    }
    return tempMoves;
  }
  
  bool PBishop::squareAvailable (int cordXI,int cordYI) {
    bool result = true;
    CSquare* currentSquare;
    CPiece* currentPiece;
    if (((cordXI > 8) || (cordYI > 8)) || ((cordYI < 1) || (cordXI < 1))) {
      result = false;
    }else { //checks if there is a piece of the own type.
      currentSquare = pos -> getSquarePointer (cordXI, cordYI);
      if (currentSquare -> containsPiece() == true) {
        currentPiece = currentSquare -> getPiecePointer();
        if (currentPiece->getColor() == this->getColor()) {
          result = false;
        } else {
                tempMoves.push_back (CPos::getSquareName (cordX, cordY) + CPos::getSquareName(cordXI, cordYI));
                result = false;
        }
      }
    }
    return result;
  }
  