[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] use fixed point arithmetics in accumulat_influence
From: |
Arend Bayer |
Subject: |
Re: [gnugo-devel] use fixed point arithmetics in accumulat_influence |
Date: |
Sun, 1 Dec 2002 00:47:59 +0100 (CET) |
Gunnar wrote:
> Maybe you misunderstood me somewhat.
Aha indeed.
> I was thinking of something that would roughly look like
>
> static void
> compute_influence(struct influence_data *q, int color, int pos,
> char no_influence[BOARDMAX], char saved_stones[BOARDMAX])
> {
> [...]
>
> [Convert needed variables from float to fixed point.]
>
> for (ii = BOARDMIN; ii < BOARDMAX; ii++)
> if (ON_BOARD(ii)) {
> if (q->white_strength[ii] > 0.0)
> accumulate_influence(q, ii, WHITE);
> if (q->black_strength[ii] > 0.0)
> accumulate_influence(q, ii, BLACK);
> }
>
> [Convert fixed point values back to float.]
>
> [...]
> }
>
> This should minimize the impact of the fixed point arithmetics. The
> question is whether it would be efficient enough.
Ok, to spell this out more precisely:
static void
accumulat_influence(struct influence_data *q, int strength, int
strength_pos, int color, const int permeabilities[BOARDMAX],
int influence[BOARDMAX])
[Generated converted fixed point permeability tables]
for (ii = BOARDMIN; ii < BOARDMAX; ii++)
if (ON_BOARD(ii)) {
if (q->white_strength[ii] > 0.0)
accumulate_influence(q, q->white_strength[ii] * GG_ONE, ii, WHITE,
white_permeabilities, white_influence[...]);
if (q->black_strength[ii] > 0.0)
accumulate_influence(q, q->black_strength[ii] * GG_ONE, ii, BLACK,
black_permeabilities, black_influence[..]);
[Convert back black_/white_influence]
Then fixed point would be limited to the function parameters and the
internal variables of accumulate_influence(). Sounds better than my
current patch, definitively.
Arend