On Wed, Jul 15, 2009 at 11:37 PM, David Fotland <fotl...@smart-games.com>wrote:

> So many complex ideas :)  Why not just multiply the weight of each pattern
> by a random number and pick the biggest result?


This is fine if you are looking for the slowest algorithm you can find.
But it does have the merit of being straightforward, which is what he was
asking for.

The binary approach is O(log n) time on average, very efficient.   Your
approach is O(n).   It's like the difference between doing a binary search
to find something or scanning the whole list sequentially.

If you are looking at less than 5 or 10 patterns there may not be much
difference, but I assumed he was choosing among many patterns.

- Don



>
>
> David
>
> > -----Original Message-----
> > From: computer-go-boun...@computer-go.org [mailto:computer-go-
> > boun...@computer-go.org] On Behalf Of Mark Boon
> > Sent: Wednesday, July 15, 2009 4:07 PM
> > To: computer-go
> > Subject: [computer-go] Random weighted patterns
> >
> > When using patterns during the playout I had improvised some code to
> > select patterns randomly, but favour those with higher weights more or
> > less proportionally to the weight..
> >
> > I was wondering though if there's an established algorithm for
> > something like this. To be a little more precise, if I have a set of
> > values and two of those are represented by A and B. If A is twice as
> > high as B it should have twice the chance to be selected. If there's a
> > third value C that is 1.5 times A then it should be 1.5 times as
> > likely to be selected as A and 3 times as likely as B. Etc.
> >
> > There are many strategies I can think of that make a randomly weighted
> > selection from a set. But none of them are really straightforward. So
> > I'd be interested to hear how others handled something like this. And
> > if there's maybe a standard known algorithm, this kind of thing must
> > appear in a lot of fields.
> >
> > Mark
> > _______________________________________________
> > 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/
>
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to