[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] influence cleanup - arend_3_11.1d
From: |
Arend Bayer |
Subject: |
[gnugo-devel] influence cleanup - arend_3_11.1d |
Date: |
Wed, 30 Oct 2002 13:14:57 -0500 (EST) |
Finally, this converts the ununrolled version of accumulate_influence()
(enable if #define EXPLICIT_LOOP_UNROLLING 0 is set) to the previous
changes.
(This patch and the previous one were again tested by comparing -m0x3ff
debug output.)
Arend
diff -u engine/influence.c engine/influence.c
--- engine/influence.c 30 Oct 2002 15:42:48 -0000
+++ engine/influence.c 30 Oct 2002 15:43:36 -0000
@@ -223,19 +223,20 @@
for (d = 0; d < 8; d++) {
int di = deltai[d];
int dj = deltaj[d];
+ int d_ii = delta[d];
- /* Verify that (i+di, j+dj) is
+ /* Verify that (ii + d_ii) is
* 1. Inside the board.
* 2. Not occupied.
* 3. Directed outwards. For the origin all directions are outwards.
*/
- if (ON_BOARD2(i+di, j+dj)
- && q->p[i+di][j+dj] == EMPTY
- && (di*(i-m) + dj*(j-n) > 0
+ if (ON_BOARD(ii + d_ii)
+ && q->p[ii + d_ii] == EMPTY
+ && (di*(delta_i) + dj*(delta_j) > 0
|| queue_start == 1)) {
float contribution;
- float permeability = permeability_array[i][j];
+ float permeability = permeability_array[ii];
float dfactor;
float inv_damping;
@@ -246,8 +247,8 @@
* account.
*/
if (d > 3) { /* diagonal movement */
- permeability *= gg_max(permeability_array[i+di][j],
- permeability_array[i][j+dj]);
+ permeability *= gg_max(permeability_array[ii + DELTA(di, 0)],
+ permeability_array[ii + DELTA(0, dj)]);
inv_damping = inv_diagonal_damping;
dfactor = 0.5;
}
@@ -262,8 +263,8 @@
contribution = permeability * current_strength * inv_damping;
/* Finally direction dependent damping. */
- if (i != m || j != n) {
- int a = di*(i-m) + dj*(j-n);
+ if (ii != pos) {
+ int a = di*(delta_i) + dj*(delta_j);
gg_assert(a > 0);
contribution *= (a*a) * b * dfactor;
}
@@ -276,14 +277,13 @@
* further spreading.
*/
if (0)
- gprintf(" Spreading %s influence from %m to %m, d=%d\n",
- color_to_string(color), i, j, i+di, j+dj, d);
- if (working[i+di][j+dj] == 0.0) {
- q->queuei[queue_end] = i + di;
- q->queuej[queue_end] = j + dj;
+ gprintf(" Spreading %s influence from %1m to %1m, d=%d\n",
+ color_to_string(color), ii, ii + d_ii, d);
+ if (working[ii + d_ii] == 0.0) {
+ q->queue[queue_end] = ii + d_ii;
queue_end++;
}
- working[i+di][j+dj] += contribution;
+ working[ii + d_ii] += contribution;
}
}
#else