     int playfieldIndex = threadIdx.x;
     int debug = 0;
 
-    //printf("Hello world from: %u\n", (size_t) playfieldIndex);
     __shared__ Field sharedPlayfield[FIELD_DIMENSION * FIELD_DIMENSION];
+    __shared__ bool possibleMoves[FIELD_DIMENSION*FIELD_DIMENSION];
+
     sharedPlayfield[playfieldIndex] = playfield[playfieldIndex];
-    __shared__ bool possibleMoves[FIELD_DIMENSION*FIELD_DIMENSION];
 
     __syncthreads();
 
     calculatePossibleMoves(possibleMoves, sharedPlayfield, playfieldIndex, currentPlayer);
     size_t moveCount = countPossibleMoves(possibleMoves, playfieldIndex, sharedPlayfield);
-    __shared__ bool counts[FIELD_DIMENSION*FIELD_DIMENSION];
-    counts[playfieldIndex] = 0;
-    __syncthreads();
-    do
-    {
-	    size_t index = FIELD_DIMENSION * FIELD_DIMENSION;
-
-        index = getRandomMoveIndex(deviceState, possibleMoves, moveCount, playfieldIndex);
-        if (playfieldIndex == 0)
-        {
-            printf("%d Moves possible ", moveCount);
-            printf("for %s ", currentPlayer == White ? "White" : "Black");
-            printf("moving to %d\n", index);
-        }
+    size_t limit = 100;
+
+    while (moveCount > 0 && debug < limit + 1)
+    {
+        __syncthreads();
+
+        size_t index = getRandomMoveIndex(deviceState, possibleMoves, moveCount, playfieldIndex);
+
+        __syncthreads();        
+        
         flipEnemyCounter(sharedPlayfield, playfieldIndex, index, currentPlayer);
 
         __syncthreads();


__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);

        calculatePossibleMoves(possibleMoves, sharedPlayfield, playfieldIndex, currentPlayer);
        moveCount = countPossibleMoves(possibleMoves, playfieldIndex, sharedPlayfield);
        debug++;
	};

    if (playfieldIndex == 0 && moveCount== 0)
        printf("Runs: %d\n", debug);
    
    __syncthreads();
    
	playfield[playfieldIndex] = sharedPlayfield[playfieldIndex];
}