示例#1
0
int update_board_after_search(Board* boardActual, Board* nextMove, BitMap* start, BitMap* end ){

	BitMap nextPlusActual = 0, auxBitMap=0;
	int i=0;

	int killer=-1;
	Compare_position_color_pieces_board(boardActual,nextMove,&killer);

	if(killer == -1){

	//if((boardActual->totalWhitePieces&nextMove->totalWhitePieces)==boardActual->totalWhitePieces){

	//TODO:no killedTypePieces valor incorrecto S'utiiliza la funcion "Compare_position_color_pieces_board() para que funcione el codigo"
	//if ( nextMove->killedTypePiece == -1 ) {


		//logChess(INFO,",,,NO KILL PIECE!!!");
		//nextPlusActual have 2 position of the movement
		nextPlusActual = boardActual->occupiedSquares ^ nextMove->occupiedSquares;
	} else {
		logChess(INFO,"---------> WE KILL<-------------\n");

		//nextPlusActual Only have 1 first position of the movement
		nextPlusActual = boardActual->occupiedSquares ^ nextMove->occupiedSquares;

		//search the position of piece killed

		for(i = 0; i < N_TYPES; i++){

			if(boardActual->myColor == WHITE){
				if((boardActual->whitePieces[i] & nextPlusActual) != 0){

					auxBitMap = boardActual->whitePieces[i] ^ nextPlusActual;

					auxBitMap = auxBitMap ^ nextMove->whitePieces[i];

					nextPlusActual = auxBitMap| nextPlusActual;
					break;
				}


			}else{
				if((boardActual->blackPieces[i] & nextPlusActual) != 0){



					auxBitMap = boardActual->blackPieces[i] ^ nextPlusActual;

					//logChess(INFO,"______Som negres auxbitmap1___\n");
					//logBoard(INFO, auxBitMap);

					auxBitMap = auxBitMap ^ nextMove->blackPieces[i];

					//logChess(INFO,"______Som negres auxbitmap2___\n");
					//logBoard(INFO, auxBitMap);

					nextPlusActual = auxBitMap | nextPlusActual;

					break;
				}

			}
		}

	}


	/*logChess(INFO,"___NEGASCOUT BOARD NO actualitzat, Actual BOARD___\n");
	logBoard(INFO, boardActual->occupiedSquares);
	logChess(INFO,"___NEGASCOUT BOARD NO actualitzat, NEXT MOVE___\n");
	logBoard(INFO, nextMove->occupiedSquares);*/
	logChess(INFO,"___NEGASCOUT BOARD NO actualitzat, MOVEMENT Start/END___\n");
	logBoard(INFO, nextPlusActual);
	logChess(INFO,"____________________\n");

	//Extracting the actual position to search in the board what piece to replace
	extractActualNextBitmap(start, end, &nextPlusActual, &(nextMove->occupiedSquares));

	//Actualize boardActual whit 2 BitMap, start(Start position of the movement) and end (End position of movement)
	actualizeBoard(boardActual,end,start);

	return SUCCESS;
}
示例#2
0
void VirusGenius::synchronizeGUI()
{
	actualizeBoard();
}