public void updatePoints() throws InterruptedException { int tolerances[][] = getToleraces(); int minXGame = bounds.x; int minYGame = bounds.y; int maxXGame = bounds.x + bounds.width; int maxYGame = bounds.y + bounds.height; short colorMap[][][] = theScript.getColorArray2d(); for(int i = 0; i < thePoints.length; i++) { boolean done = false; for(int size = 1; size < 5 && !done; size++) { int minX = (int)((float)thePoints[i].x - ((float)size * zoneDx) / 2.0F); int minY = (int)((float)thePoints[i].y - ((float)size * zoneDy) / 2.0F); int maxX = (int)((float)thePoints[i].x + ((float)size * zoneDx) / 2.0F); int maxY = (int)((float)thePoints[i].y + ((float)size * zoneDy) / 2.0F); if(minX < minXGame) minX = minXGame; if(minY < minYGame) minY = minYGame; if(maxX > maxXGame) maxX = maxXGame; if(maxY > maxYGame) maxY = maxYGame; int interval = 6; int smallerWinnerX = -1; int smallerWinnerY = -1; int smallerWinnerCount = -1; for(int x = minX; x < maxX; x += 6) { for(int y = minY; y < maxY; y += 6) { int count = 0; for(int k = 0; k < theRGBs.length; k++) count += StaticColorMethods.numRGBs(colorMap, theRGBs[k], x, y, x + 6, y + 6, tolerances[k][0], tolerances[k][1], tolerances[k][2]); if(count > smallerWinnerCount) { smallerWinnerX = x + 3; smallerWinnerY = y + 3; smallerWinnerCount = count; } } } if((smallerWinnerCount * 3) / 2 >= matchesAtAPoint[i]) { done = true; thePoints[i] = new XY(smallerWinnerX, smallerWinnerY); matchesAtAPoint[i] = smallerWinnerCount; } } } }