Lines Matching defs:runHistory
417 int[] runHistory = new int[7];
423 Arrays.fill(runHistory, 0);
435 finderPenaltyAddHistory(runX, runHistory);
437 result += finderPenaltyCountPatterns(runHistory) * PENALTY_N3;
450 result += finderPenaltyTerminateAndCount(runColor, runX, runHistory) * PENALTY_N3;
457 Arrays.fill(runHistory, 0);
467 finderPenaltyAddHistory(runY, runHistory);
469 result += finderPenaltyCountPatterns(runHistory) * PENALTY_N3;
474 result += finderPenaltyTerminateAndCount(runColor, runY, runHistory) * PENALTY_N3;
501 private int finderPenaltyCountPatterns(int[] runHistory) {
502 int n = runHistory[1];
504 boolean core = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n;
505 return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0)
506 + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);
511 private int finderPenaltyTerminateAndCount(int currentRunColor, int currentRunLength, int[] runHistory) {
513 finderPenaltyAddHistory(currentRunLength, runHistory);
517 finderPenaltyAddHistory(currentRunLength, runHistory);
518 return finderPenaltyCountPatterns(runHistory);
523 private void finderPenaltyAddHistory(int currentRunLength, int[] runHistory) {
524 if (runHistory[0] == 0)
526 System.arraycopy(runHistory, 0, runHistory, 1, runHistory.length - 1);
527 runHistory[0] = currentRunLength;