 
 __device__ void flipEnemyCounter(Field* playfield, size_t playfieldIndex, size_t moveIndex, Player currentPlayer)
 {
-	int playfieldX =  playfieldIndex % FIELD_DIMENSION;
-	int playfieldY =  playfieldIndex / FIELD_DIMENSION;
 	int directionX = playfieldIndex % FIELD_DIMENSION - moveIndex % FIELD_DIMENSION;
     int directionY = playfieldIndex / FIELD_DIMENSION - moveIndex / FIELD_DIMENSION;
-    //if ((abs(directionY) == 1 || abs(directionX) == 1) && directionX + directionY <= 2)
+
     if (abs(directionX) <= 1 && abs(directionY) <= 1 && moveIndex != playfieldIndex)
     {
     	flipDirection(playfield, playfieldIndex, moveIndex, directionX, directionY, currentPlayer);

__device__  void calculatePossibleMoves(bool* possibleMoves, Field* sharedPlayfield, size_t playfieldIndex, Player currentPlayer)
{
    possibleMoves[playfieldIndex] = false;
    __syncthreads();

    if (sharedPlayfield[playfieldIndex] == Free)


__device__ size_t countPossibleMoves(bool* possibleMoves, size_t playfieldIndex, Field* playfield)
{
	// __syncthreads();
 //    __shared__ size_t moves[FIELD_DIMENSION * FIELD_DIMENSION];
 //    moves[playfieldIndex] = possibleMoves[playfieldIndex] ? 1 : 0;
	// return sum(moves, playfieldIndex, FIELD_DIMENSION * FIELD_DIMENSION);
    
    __syncthreads();
    size_t sum = 0;
    for (int i = 0; i < FIELD_DIMENSION * FIELD_DIMENSION; i++)
    {
        if (possibleMoves[i])
        {
            sum++;
            __syncthreads();
        }
    }
    return sum;
}

__device__ void flipDirection(Field* playfield, size_t playfieldIndex, size_t moveIndex, int directionX, int directionY, Player currentPlayer)
