As promised I tested this on the C reference bot.  I get almost a 12%
speedup - 36.0 seconds versus 40.2

- Don




On Tue, 2008-10-28 at 11:41 -0400, Michael Williams wrote:
> You can add the check back in and be more efficient than Don's nested loop by 
> doing something like this (warning: untested code)...
> 
> 
> 
>          for (int mv = 0; mv < NNN; mv++)
>          {
>              credit[mv] = true; // initial assumption is that credit is 
> awarded for any move
>          }
>          double weight = 1.0;
>          double weightDelta = 2.0 / (ctm - savctm + 1);
>          for (int i = savctm; i < ctm; i += 2)
>          {
>              int mv = mvs[i] & MASK;
> 
>              if (credit[mv])
>              {
>                  wins[mv] += weight * sc;
>                  hits[mv] += weight;
>                  credit[mv] = false;  // do not award credit for this move 
> again
>              }
>              weight -= weightDelta;
> 
>              credit[mvs[i+1] & MASK] = false;  // do not award credit for the 
> opponent's move
>          }
> 
> 
> 
> 
> Mark Boon wrote:
> > Hehe, this reminds me of the title of a CNN program: 'Keeping them 
> > honest' ;-)
> > 
> > OK, let me add that check back in to see if I get better results.
> > 
> > Mark
> > 
> > On 28-okt-08, at 13:18, Michael Williams wrote:
> > 
> >> My original chart of numbers was created before it occurred to me that 
> >> maybe the check whether the move has been played before is not 
> >> needed.  It is of course possible that the check IS needed.  I ran a 
> >> new test after removing that check and the numbers don't look as good:
> >>
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > _______________________________________________
> > computer-go mailing list
> > computer-go@computer-go.org
> > http://www.computer-go.org/mailman/listinfo/computer-go/
> 
> _______________________________________________
> computer-go mailing list
> computer-go@computer-go.org
> http://www.computer-go.org/mailman/listinfo/computer-go/

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to