Exemplo n.º 1
0
void Gizmo3D::Drag()
{
    bool moved = false;

    float scale = gizmoNode_->GetScale().x_;

    if (editMode_ == EDIT_MOVE)
    {
        Vector3 adjust(0, 0, 0);
        if (gizmoAxisX_.selected_)
            adjust += Vector3(1, 0, 0) * (gizmoAxisX_.t_ - gizmoAxisX_.lastT_);
        if (gizmoAxisY_.selected_)
            adjust += Vector3(0, 1, 0) * (gizmoAxisY_.t_ - gizmoAxisY_.lastT_);
        if (gizmoAxisZ_.selected_)
            adjust += Vector3(0, 0, 1) * (gizmoAxisZ_.t_ - gizmoAxisZ_.lastT_);

        moved = MoveEditNodes(adjust);
    }
    else if (editMode_ == EDIT_ROTATE)
    {
        const float rotSensitivity = 50.0;

        Vector3 adjust(0, 0, 0);
        if (gizmoAxisX_.selected_)
            adjust.x_ = (gizmoAxisX_.d_ - gizmoAxisX_.lastD_) * rotSensitivity / scale;
        if (gizmoAxisY_.selected_)
            adjust.y_ = -(gizmoAxisY_.d_ - gizmoAxisY_.lastD_) * rotSensitivity / scale;
        if (gizmoAxisZ_.selected_)
            adjust.z_ = (gizmoAxisZ_.d_ - gizmoAxisZ_.lastD_) * rotSensitivity / scale;

        moved = RotateEditNodes(adjust);
    }
    else if (editMode_ == EDIT_SCALE)
    {
        Vector3 adjust(0, 0, 0);
        if (gizmoAxisX_.selected_)
            adjust += Vector3(1, 0, 0) * (gizmoAxisX_.t_ - gizmoAxisX_.lastT_);
        if (gizmoAxisY_.selected_)
            adjust += Vector3(0, 1, 0) * (gizmoAxisY_.t_ - gizmoAxisY_.lastT_);
        if (gizmoAxisZ_.selected_)
            adjust += Vector3(0, 0, 1) * (gizmoAxisZ_.t_ - gizmoAxisZ_.lastT_);

        // Special handling for uniform scale: use the unmodified X-axis movement only
        if (editMode_ == EDIT_SCALE && gizmoAxisX_.selected_ && gizmoAxisY_.selected_ && gizmoAxisZ_.selected_)
        {
            float x = gizmoAxisX_.t_ - gizmoAxisX_.lastT_;
            adjust = Vector3(x, x, x);
        }

        moved = ScaleEditNodes(adjust);
    }

    if (moved)
    {
        Moved();
        //UpdateNodeAttributes();
        //needGizmoUndo = true;
    }

}
Exemplo n.º 2
0
void CShareBox::mouseReleaseEvent(QMouseEvent * event)
{
    if(event->button() == Qt::LeftButton)
    {
        m_dragging = false;
        emit Moved();
    }
}
Exemplo n.º 3
0
void Object::SetPosition(float x, float y)
{
	
	PhysicsObject::SetPosition(x, y);

	Moved();

}
Exemplo n.º 4
0
void Object::SetPosition(Vec2f v)
{
	
	PhysicsObject::SetPosition(v);

	Moved();

}
Exemplo n.º 5
0
bool fish::move(int x, int y){
    if (attacked || moved || hp[ID] <= 0) return 0;
    if (x <= 0 || y <= 0 || x > N || y > M) return 0;
    if (Map[x][y] != EMPTY || !in_range(posx, posy, x, y, Speed)) return 0;
	Map[posx][posy] = EMPTY;
	posx = x; posy = y; moved = 1; 
	Map[x][y] = ID; 
    emit Moved(ID, x, y);
	return 1;
}
Exemplo n.º 6
0
void Active::Move(const dirs dir) {
    switch ( dir ) {
    case UP:    ++z_self; break;
    case DOWN:  --z_self; break;
    case NORTH: --y_self; ReRegister(NORTH); break;
    case EAST:  ++x_self; ReRegister(EAST ); break;
    case SOUTH: ++y_self; ReRegister(SOUTH); break;
    case WEST:  --x_self; ReRegister(WEST ); break;
    }
    Moved(dir);
}
Exemplo n.º 7
0
void
ColumnTrackState::MouseMoved(BPoint where, uint32 buttons)
{
	if (!fHasMoved && system_time() < fPastClickTime) {
		BRect moveMargin(fFirstClickPoint, fFirstClickPoint);
		moveMargin.InsetBy(-1, -1);

		if (moveMargin.Contains(where))
			return;
	}

	Moved(where, buttons);
	fHasMoved = true;
}
Exemplo n.º 8
0
/***************************************************
RedrawRange
	function is called to redraw a single cell, it will add provided cells
	to draw hints (CUGDrawHint) and forces the window to update.
Params:
	startCol,	- parameters passed in indicate the range of cells to be redrawn
	startRow,	  the range's top-left corned is indicated by the StartCol and
	endCol,		  StartRow, and the bottom-right corner by the endCol and endRow.
	endRow
Returns:
	<none>
*****************************************************/
void CUGGrid::RedrawRange(int startCol,long startRow,int endCol,long endRow)
{
	m_drawHint.AddHint(startCol,startRow,endCol,endRow);
	Moved();
}
Exemplo n.º 9
0
/***************************************************
RedrawCol
	function is called to redraw a single cell, it will add provided cells
	to draw hints (CUGDrawHint) and forces the window to update.
Params:
	col			- indicates the column number to update.
Returns:
	<none>
*****************************************************/
void CUGGrid::RedrawCol(int col)
{
	m_drawHint.AddHint(col,0,col,m_GI->m_numberRows-1);
	Moved();
}
Exemplo n.º 10
0
/***************************************************
RedrawRow
	function is called to redraw a single cell, it will add provided cells
	to draw hints (CUGDrawHint) and forces the window to update.
Params:
	row			- indicates the row number to update.
Returns:
	<none>
*****************************************************/
void CUGGrid::RedrawRow(long row)
{
	m_drawHint.AddHint(0,row,m_GI->m_numberCols-1,row);
	Moved();
}
Exemplo n.º 11
0
/***************************************************
RedrawCell
	function is called to redraw a single cell, it will add provided cell
	to draw hints (CUGDrawHint) and forces the window to update.
Params:
	col, row	- coordinates of cell to redraw
Returns:
	<none>
*****************************************************/
void CUGGrid::RedrawCell(int col,long row)
{
	m_drawHint.AddHint(col,row);
	Moved();
}
Exemplo n.º 12
0
static void
init_canvas( FL_OBJECT * ob )
{
    FLI_CANVAS_SPEC *sp = ob->spec;
    static int nc;      /* number of canvases */
    char name[ 32 ];

    if ( ! sp->window || ! fl_winisvalid( sp->window ) )
    {
        /* Find the real parent of the canvas */

        sp->parent = fl_get_real_object_window( ob );
        sp->window = None;

        if ( sp->parent == None )
        {
            M_err( "init_canvas", "Internal Error" );
            exit( 0 );
        }

        if ( sp->init && sp->init( ob ) < 0 )
        {
            M_err( "init_canvas", "Unable to initialize canvas %s", ob->label );
            return;
        }

        /* Create the window */

        sp->window = XCreateWindow( flx->display, sp->parent,
                                    ob->x, ob->y, ob->w, ob->h, 0,
                                    sp->depth, InputOutput,
                                    sp->visual, sp->mask, &sp->xswa );

        if ( sp->user_mask )
            XChangeWindowAttributes( flx->display, sp->window,
                                     sp->user_mask, &sp->user_xswa );

#if FL_DEBUG >= ML_ERR
        M_warn( "init_canvas", "Depth = %d colormap = 0x%lx, WinID = %ld",
                sp->depth, sp->colormap, sp->window );
#endif

        /* Take over event handling */

        fli_set_preemptive_callback( sp->window, canvas_event_intercept, ob );

        if ( sp->activate && sp->activate( ob ) < 0 )
        {
            M_err( "init_canvas", "Can't initialize canvas %s", ob->label );
            return;
        }

        /* Record the name of the window */
        
        if ( *ob->label )
            XStoreName( flx->display, sp->window, ob->label );
        else
        {
            sprintf( name, "flcanvas%d", nc++ );
            XStoreName( flx->display, sp->window, name );
        }

        BegWMColormap( sp );

        XMapWindow( flx->display, sp->window );

        /* Save size */

        sp->x = ob->x;
        sp->y = ob->y;
        sp->w = ob->w;
        sp->h = ob->h;
    }

    /* Check if moved or resized */

    if ( Moved( ob, sp ) || Resized( ob, sp ) )
    {
        M_warn( "init_canvas", "Canvas: WinMoved\n" );
        XMoveResizeWindow( flx->display, sp->window, ob->x, ob->y,
                           ob->w, ob->h );
    }

    sp->x = ob->x;
    sp->y = ob->y;
    sp->w = ob->w;
    sp->h = ob->h;

    if ( ob->col1 != FL_NoColor )
        XClearWindow( flx->display, sp->window );

    sp->dec_type = fli_boxtype2frametype( ob->boxtype );
    fl_draw_frame( sp->dec_type, ob->x, ob->y, ob->w, ob->h, ob->col2, ob->bw );
}
Exemplo n.º 13
0
/***************************************************
Update
	function forces window update.
Params:
	<none>
Returns:
	<none>
*****************************************************/
void CUGHScroll::Update()
{
	Moved();
}
Exemplo n.º 14
0
void World::ReloadShreds(const int direction) {
	short x, y; // do not make unsigned, values <0 are needed for checks
	RemSun();
	switch ( direction ) {
	case NORTH:
		--longitude;
		for (x=0; x<numShreds; ++x) {
			const Shred * const shred = *FindShred(x, numShreds-1);
			Shred * const memory = shred->GetShredMemory();
			shred->~Shred();
			for (y=numShreds-1; y>0; --y) {
				( *FindShred(x, y) = *FindShred(x, y-1) )->
					ReloadToNorth();
			}
			*FindShred(x, 0) = new(memory)
				Shred(x, 0,
					longitude-numShreds/2,
					latitude -numShreds/2+x, memory);
		}
	break;
	case SOUTH:
		++longitude;
		for (x=0; x<numShreds; ++x) {
			const Shred * const shred = *FindShred(x, 0);
			Shred * const memory = shred->GetShredMemory();
			shred->~Shred();
			for (y=0; y<numShreds-1; ++y) {
				( *FindShred(x, y) = *FindShred(x, y+1) )->
					ReloadToSouth();
			}
			*FindShred(x, numShreds-1) = new(memory)
				Shred(x, numShreds-1,
					longitude+numShreds/2,
					latitude -numShreds/2+x, memory);
		}
	break;
	case EAST:
		++latitude;
		for (y=0; y<numShreds; ++y) {
			const Shred * const shred = *FindShred(0, y);
			Shred * const memory = shred->GetShredMemory();
			shred->~Shred();
			for (x=0; x<numShreds-1; ++x) {
				( *FindShred(x, y) = *FindShred(x+1, y) )->
					ReloadToEast();
			}
			*FindShred(numShreds-1, y) = new(memory)
				Shred(numShreds-1, y,
					longitude-numShreds/2+y,
					latitude +numShreds/2, memory);
		}
	break;
	case WEST:
		--latitude;
		for (y=0; y<numShreds; ++y) {
			const Shred * const shred = *FindShred(numShreds-1, y);
			Shred * const memory = shred->GetShredMemory();
			shred->~Shred();
			for (x=numShreds-1; x>0; --x) {
				( *FindShred(x, y) = *FindShred(x-1, y) )->
					ReloadToWest();
			}
			*FindShred(0, y) = new(memory)
				Shred(0, y,
					longitude-numShreds/2+y,
					latitude -numShreds/2, memory);
		}
	break;
	default: fprintf(stderr,
		"World::ReloadShreds(int): invalid direction: %d\n",
		direction);
	}
	shredStorage->Shift(direction, longitude, latitude);
	MakeSun();
	ReEnlightenMove(direction);
	emit Moved(direction);
} // void World::ReloadShreds(int direction)
Exemplo n.º 15
0
void MakeMove(const int& move)
{
#ifdef DEBUG_MODE
	Debugger::searchLine[currentDepth] = move;
#endif
	storeWhiteCastle[currentDepth] = whiteCastle;
	storeBlackCastle[currentDepth] = blackCastle;
	storeEnPassant[currentDepth] = enPassant;
	storeHashKeys[currentDepth] = currentPositionKey;
	storePieceSquareScore[currentDepth] = pieceSquareScore;

	if (enPassant != NoEnPassant)
	{
		currentPositionKey ^= TranspoTable::EnPassantKeys[enPassant];
		enPassant = NoEnPassant;
	}
	currentDepth++;

	repetitionFifty[currentDepth] = repetitionFifty[currentDepth - 1] + 1;

	Square startSquare = Start(move);
	Square endSquare = End(move);
	Piece capturedType = Captured(move);
	Piece promotedType = Promoted(move);
	Piece movedType = Moved(move);

	//General procedures applied to any kind of pieces/moves
	pieceTypes[startSquare] = PieceIndex::NoPiece;
	pieceTypes[endSquare] = movedType;
	Bitboard sourceBit = 1ull << startSquare;
	Bitboard destBit = 1ull << endSquare;
	Bitboard combBit = sourceBit ^ destBit;

	//specific pieces update
	if (whiteToMove)
	{
		switch (movedType)
		{
		case PieceIndex::WhitePawn:
			if (promotedType != PieceIndex::NoPiece)
			{
				pieceBitboards[PieceIndex::WhitePawn] ^= sourceBit;
				whitePawnScore -= PieceScore::PawnScore;

				switch (promotedType)
				{
				case PieceIndex::WhiteQueen:
					pieceBitboards[PieceIndex::WhiteQueen] ^= destBit;
					pieceBitboards[PieceIndex::WhiteRookQueen] ^= destBit;
					pieceBitboards[PieceIndex::WhiteBishopQueen] ^= destBit;
					pieceTypes[endSquare] = PieceIndex::WhiteQueen;
					whitePieceScore += PieceScore::QueenScore;
					pieceSquareScore -= PieceSquareTable[PieceIndex::WhitePawn - 2][startSquare];
					pieceSquareScore += PieceSquareTable[PieceIndex::WhiteQueen - 2][endSquare];
					currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::WhiteQueen - 2][endSquare] ^ TranspoTable::ZobristKeys[PieceIndex::WhitePawn - 2][startSquare];
					pawnStructureKey ^= PawnTranspoTable::ZobristKeys[PawnTableWhiteIndex][startSquare];
					break;
				case PieceIndex::WhiteKnight:
					pieceBitboards[PieceIndex::WhiteKnight] ^= destBit;
					pieceTypes[endSquare] = PieceIndex::WhiteKnight;
					whitePieceScore += PieceScore::KnightScore;
					pieceSquareScore -= PieceSquareTable[PieceIndex::WhitePawn - 2][startSquare];
					pieceSquareScore += PieceSquareTable[PieceIndex::WhiteKnight - 2][endSquare];
					currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::WhiteKnight - 2][endSquare] ^ TranspoTable::ZobristKeys[PieceIndex::WhitePawn - 2][startSquare];
					pawnStructureKey ^= PawnTranspoTable::ZobristKeys[PawnTableWhiteIndex][startSquare];
					break;
				case PieceIndex::WhiteRook:
					pieceBitboards[PieceIndex::WhiteRook] ^= destBit;
					pieceBitboards[PieceIndex::WhiteRookQueen] ^= destBit;
					pieceTypes[endSquare] = PieceIndex::WhiteRook;
					whitePieceScore += PieceScore::RookScore;
					pieceSquareScore -= PieceSquareTable[PieceIndex::WhitePawn - 2][startSquare];
					pieceSquareScore += PieceSquareTable[PieceIndex::WhiteRook - 2][endSquare];
					currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::WhiteRook - 2][endSquare] ^ TranspoTable::ZobristKeys[PieceIndex::WhitePawn - 2][startSquare];
					pawnStructureKey ^= PawnTranspoTable::ZobristKeys[PawnTableWhiteIndex][startSquare];
					break;
				case PieceIndex::WhiteBishop:
					pieceBitboards[PieceIndex::WhiteBishop] ^= destBit;
					pieceBitboards[PieceIndex::WhiteBishopQueen] ^= destBit;
					pieceTypes[endSquare] = PieceIndex::WhiteBishop;
					whitePieceScore += PieceScore::BishopScore;
					pieceSquareScore -= PieceSquareTable[PieceIndex::WhitePawn - 2][startSquare];
					pieceSquareScore += PieceSquareTable[PieceIndex::WhiteBishop - 2][endSquare];
					currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::WhiteBishop - 2][endSquare] ^ TranspoTable::ZobristKeys[PieceIndex::WhitePawn - 2][startSquare];
					pawnStructureKey ^= PawnTranspoTable::ZobristKeys[PawnTableWhiteIndex][startSquare];
					break;
				}
			} else
			{
				pieceBitboards[PieceIndex::WhitePawn] ^= combBit;
				currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::WhitePawn - 2][startSquare] ^ TranspoTable::ZobristKeys[PieceIndex::WhitePawn - 2][endSquare];
				pawnStructureKey ^= PawnTranspoTable::ZobristKeys[PawnTableWhiteIndex][startSquare] ^ PawnTranspoTable::ZobristKeys[PawnTableWhiteIndex][endSquare];
				pieceSquareScore += PieceSquareTable[PieceIndex::WhitePawn - 2][endSquare]
				- PieceSquareTable[PieceIndex::WhitePawn - 2][startSquare];
				if ((endSquare - startSquare) == 16)
				{
					enPassant = endSquare - 8;
					currentPositionKey ^= TranspoTable::EnPassantKeys[enPassant];
				}
			}
			repetitionFifty[currentDepth] = 0;
			break;

		case PieceIndex::WhiteKnight:
			pieceBitboards[PieceIndex::WhiteKnight] ^= combBit;
			currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::WhiteKnight - 2][startSquare] ^ TranspoTable::ZobristKeys[PieceIndex::WhiteKnight - 2][endSquare];
			pieceSquareScore += PieceSquareTable[PieceIndex::WhiteKnight - 2][endSquare] - PieceSquareTable[PieceIndex::WhiteKnight - 2][startSquare];
			break;

		case PieceIndex::WhiteBishop:
			pieceBitboards[PieceIndex::WhiteBishop] ^= combBit;
			pieceBitboards[PieceIndex::WhiteBishopQueen] ^= combBit;
			currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::WhiteBishop - 2][startSquare] ^ TranspoTable::ZobristKeys[PieceIndex::WhiteBishop - 2][endSquare];
			pieceSquareScore += PieceSquareTable[PieceIndex::WhiteBishop - 2][endSquare] - PieceSquareTable[PieceIndex::WhiteBishop - 2][startSquare];
			break;

		case PieceIndex::WhiteRook:
			pieceBitboards[PieceIndex::WhiteRook] ^= combBit;
			pieceBitboards[PieceIndex::WhiteRookQueen] ^= combBit;
			currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::WhiteRook - 2][startSquare] ^ TranspoTable::ZobristKeys[PieceIndex::WhiteRook - 2][endSquare];
			pieceSquareScore += PieceSquareTable[PieceIndex::WhiteRook - 2][endSquare] - PieceSquareTable[PieceIndex::WhiteRook - 2][startSquare];
			if (whiteCastle != NoCastling)
			{
				if (startSquare == Squares::A1 && LongCastle(whiteCastle) != 0)
				{
					currentPositionKey ^= TranspoTable::WhiteLongCastleKey;
					whiteCastle &= 1;
					repetitionFifty[currentDepth] = 0;
				} else if (startSquare == Squares::H1 && ShortCastle(whiteCastle) != 0)
				{
					currentPositionKey ^= TranspoTable::WhiteShortCastleKey;
					whiteCastle &= 2;
					repetitionFifty[currentDepth] = 0;
				}
			}
			break;

		case PieceIndex::WhiteQueen:
			pieceBitboards[PieceIndex::WhiteQueen] ^= combBit;
			pieceBitboards[PieceIndex::WhiteRookQueen] ^= combBit;
			pieceBitboards[PieceIndex::WhiteBishopQueen] ^= combBit;
			currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::WhiteQueen - 2][startSquare] ^ TranspoTable::ZobristKeys[PieceIndex::WhiteQueen - 2][endSquare];
			pieceSquareScore += PieceSquareTable[PieceIndex::WhiteQueen - 2][endSquare] - PieceSquareTable[PieceIndex::WhiteQueen - 2][startSquare];
			break;

		case PieceIndex::WhiteKing:
			pieceBitboards[PieceIndex::WhiteKing] ^= combBit;
			currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::WhiteKing - 2][startSquare]
			^ TranspoTable::ZobristKeys[PieceIndex::WhiteKing - 2][endSquare];
			pieceSquareScore += PieceSquareTable[PieceIndex::WhiteKing - 2][endSquare] - PieceSquareTable[PieceIndex::WhiteKing - 2][startSquare];

			if (whiteCastle != NoCastling)
			{
				if (endSquare - startSquare == 2)
				{
					pieceBitboards[PieceIndex::WhiteRook] ^= 0xA0l; //0xA0 == '10100000'
					pieceBitboards[PieceIndex::WhiteRookQueen] ^= 0xA0l;
					pieceBitboards[PieceIndex::WhitePieces] ^= 0xA0l;
					pieceBitboards[PieceIndex::AllPieces] ^= 0xA0l;
					pieceTypes[Squares::H1] = PieceIndex::NoPiece;
					pieceTypes[Squares::F1] = PieceIndex::WhiteRook;
					currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::WhiteRook - 2][Squares::H1] ^ TranspoTable::ZobristKeys[PieceIndex::WhiteRook - 2][Squares::F1];
					pieceSquareScore += PieceSquareTable[PieceIndex::WhiteRook - 2][Squares::F1] - PieceSquareTable[PieceIndex::WhiteRook - 2][Squares::H1];
				} else if (endSquare - startSquare == -2)
				{
					pieceBitboards[PieceIndex::WhiteRook] ^= 0x9l; //0x9 == '00001001'
					pieceBitboards[PieceIndex::WhiteRookQueen] ^= 0x9l;
					pieceBitboards[PieceIndex::WhitePieces] ^= 0x9l;
					pieceBitboards[PieceIndex::AllPieces] ^= 0x9l;
					pieceTypes[Squares::A1] = PieceIndex::NoPiece;
					pieceTypes[Squares::D1] = PieceIndex::WhiteRook;
					currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::WhiteRook - 2][Squares::A1] ^ TranspoTable::ZobristKeys[PieceIndex::WhiteRook - 2][Squares::D1];
					pieceSquareScore += PieceSquareTable[PieceIndex::WhiteRook - 2][Squares::D1] - PieceSquareTable[PieceIndex::WhiteRook - 2][Squares::A1];
				}
				if (LongCastle(whiteCastle) != 0)
				{
					currentPositionKey ^= TranspoTable::WhiteLongCastleKey;
				}
				if (ShortCastle(whiteCastle) != 0)
				{
					currentPositionKey ^= TranspoTable::WhiteShortCastleKey;
				}
				whiteCastle = NoCastling;
				repetitionFifty[currentDepth] = 0;
			}
			break;
		}

		pieceBitboards[PieceIndex::WhitePieces] ^= combBit;
		pieceBitboards[PieceIndex::AllPieces] ^= combBit;

		if (capturedType != PieceIndex::NoPiece)
		{
			switch (capturedType)
			{
			case PieceIndex::BlackPawn:
				pieceBitboards[PieceIndex::BlackPawn] ^= destBit;
				pieceBitboards[PieceIndex::BlackPieces] ^= destBit;
				pieceBitboards[PieceIndex::AllPieces] ^= destBit;
				blackPawnScore -= PieceScore::PawnScore;
				pieceSquareScore += PieceSquareTable[PieceIndex::BlackPawn - 2][endSquare];
				currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::BlackPawn - 2][endSquare];
				pawnStructureKey ^= PawnTranspoTable::ZobristKeys[PawnTableBlackIndex][endSquare];
				break;

			case PieceIndex::BlackKnight:
				pieceBitboards[PieceIndex::BlackKnight] ^= destBit;
				pieceBitboards[PieceIndex::BlackPieces] ^= destBit;
				pieceBitboards[PieceIndex::AllPieces] ^= destBit;
				blackPieceScore -= PieceScore::KnightScore;
				pieceSquareScore += PieceSquareTable[PieceIndex::BlackKnight - 2][endSquare];
				currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::BlackKnight - 2][endSquare];
				break;

			case PieceIndex::BlackBishop:
				pieceBitboards[PieceIndex::BlackBishop] ^= destBit;
				pieceBitboards[PieceIndex::BlackBishopQueen] ^= destBit;
				pieceBitboards[PieceIndex::BlackPieces] ^= destBit;
				pieceBitboards[PieceIndex::AllPieces] ^= destBit;
				blackPieceScore -= PieceScore::BishopScore;
				pieceSquareScore += PieceSquareTable[PieceIndex::BlackBishop - 2][endSquare];
				currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::BlackBishop - 2][endSquare];
				break;

			case PieceIndex::BlackRook:
				pieceBitboards[PieceIndex::BlackRook] ^= destBit;
				pieceBitboards[PieceIndex::BlackRookQueen] ^= destBit;
				pieceBitboards[PieceIndex::BlackPieces] ^= destBit;
				pieceBitboards[PieceIndex::AllPieces] ^= destBit;
				blackPieceScore -= PieceScore::RookScore;
				pieceSquareScore += PieceSquareTable[PieceIndex::BlackRook - 2][endSquare];
				currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::BlackRook - 2][endSquare];
				if (blackCastle != NoCastling)
				{
					if (endSquare == Squares::A8 && LongCastle(blackCastle) != 0)
					{
						currentPositionKey ^= TranspoTable::BlackLongCastleKey;
						blackCastle &= 1;
					} else if (endSquare == Squares::H8 && ShortCastle(blackCastle) != 0)
					{
						currentPositionKey ^= TranspoTable::BlackShortCastleKey;
						blackCastle &= 2;
					}
				}
				break;

			case PieceIndex::BlackQueen:
				pieceBitboards[PieceIndex::BlackQueen] ^= destBit;
				pieceBitboards[PieceIndex::BlackRookQueen] ^= destBit;
				pieceBitboards[PieceIndex::BlackBishopQueen] ^= destBit;
				pieceBitboards[PieceIndex::BlackPieces] ^= destBit;
				pieceBitboards[PieceIndex::AllPieces] ^= destBit;
				blackPieceScore -= PieceScore::QueenScore;
				pieceSquareScore += PieceSquareTable[PieceIndex::BlackQueen - 2][endSquare];
				currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::BlackQueen - 2][endSquare];
				break;

			case PieceIndex::EnPassant:
				Bitboard enPassantBit = destBit >> 8;
				Square enPassantSquare = endSquare - 8;
				pieceBitboards[PieceIndex::BlackPawn] ^= enPassantBit;
				pieceBitboards[PieceIndex::BlackPieces] ^= enPassantBit;
				pieceBitboards[PieceIndex::AllPieces] ^= enPassantBit;
				pieceTypes[enPassantSquare] = PieceIndex::NoPiece;
				blackPawnScore -= PieceScore::PawnScore;
				pieceSquareScore += PieceSquareTable[PieceIndex::BlackPawn - 2][enPassantSquare];
				currentPositionKey ^= TranspoTable::ZobristKeys[PieceIndex::BlackPawn - 2][enPassantSquare];
				pawnStructureKey ^= PawnTranspoTable::ZobristKeys[PawnTableBlackIndex][enPassantSquare];
				break;
			}
			repetitionFifty[currentDepth] = 0;
		}
	} else
	{
		switch (movedType)
Exemplo n.º 16
0
void RenderWidget::moveEvent(QMoveEvent* event)
{
    Moved(event->pos().x(), event->pos().y());
}