Re: [computer-go] Speed of generating random playouts

2007-12-04 Thread Zach Wegner
On Nov 13, 2007 2:44 PM, Jason House [EMAIL PROTECTED] wrote: On Nov 13, 2007 3:32 PM, John Tromp [EMAIL PROTECTED] wrote: Is there any known way to get the best of the both worlds? :-) Yes, you can generalize pseudoliberties by extending them with another field, such that if the

Re: [computer-go] Speed of generating random playouts

2007-12-04 Thread Álvaro Begué
On Dec 4, 2007 3:57 PM, Zach Wegner [EMAIL PROTECTED] wrote: On Nov 13, 2007 2:44 PM, Jason House [EMAIL PROTECTED] wrote: On Nov 13, 2007 3:32 PM, John Tromp [EMAIL PROTECTED] wrote: Is there any known way to get the best of the both worlds? :-) Yes, you can generalize

Re: [computer-go] Speed of generating random playouts

2007-11-24 Thread Jason House
On Thu, 2007-11-15 at 15:20 -0500, Eric Boesch wrote: John and Jason's optimization suggestions are both good, but they point in different directions. (Of course, John had a complete solution to begin with.) I have a 64-bit machine, and in that case I think that the bitmask approach, with

Re: [computer-go] Speed of generating random playouts

2007-11-17 Thread Chris Fant
On Nov 16, 2007 10:44 PM, Imran Hendley [EMAIL PROTECTED] wrote: On Nov 16, 2007 6:38 PM, Chris Fant [EMAIL PROTECTED] wrote: Neat. Was the 15-bit version for 81 values or 361? At the risk of putting my foot in my mouth, I don't think there exist 361 15-bit numbers that satisfy

Re: [computer-go] Speed of generating random playouts

2007-11-16 Thread Lavergne Thomas
It come from me ;-) This was a sequel of the first brute force I have used. I must start it with a number, and it search from this one the first number bigger that doesn't violate the violate the tests, add it to the list and repeat this until it have enough numbers. This implementation was very

Re: [computer-go] Speed of generating random playouts

2007-11-16 Thread Martin Møller Skarbiniks Pedersen
On 12/11/2007, Petr Baudis [EMAIL PROTECTED] wrote: I have rewritten it so that it now picks a random point at the board, then searches the whole board starting from that point and picks up the first valid point. That is a bad way to random choose a point. Some point will be choosen a lot

Re: [computer-go] Speed of generating random playouts

2007-11-16 Thread Álvaro Begué
On Nov 16, 2007 10:54 AM, A van Kessel [EMAIL PROTECTED] wrote: Yep, I think I had a bug. I just removed an optimization that I I just checked your array, and found that {14 56 383 3047} -- 3500 -- 875, which is also in the array. Back to the old drawing board. BTW I don't get this

Re: [computer-go] Speed of generating random playouts

2007-11-16 Thread Chris Fant
Neat. Was the 15-bit version for 81 values or 361? At the risk of putting my foot in my mouth, I don't think there exist 361 15-bit numbers that satisfy minimum requirements (if the floating-point average of any four code values is a code value, then the four code values are identical).

Re: [computer-go] Speed of generating random playouts

2007-11-16 Thread Eric Boesch
On 11/15/07, Chris Fant [EMAIL PROTECTED] wrote: On Nov 15, 2007 3:20 PM, Eric Boesch [EMAIL PROTECTED] wrote: On 11/14/07, Chris Fant [EMAIL PROTECTED] wrote: Based on more recent emails, this may not be useful anymore, but I have a list of 361 32-bit numbers that satisfy these

Re: [computer-go] Speed of generating random playouts

2007-11-16 Thread Chris Fant
Start with 500 random numbers. Throw out the ones that violate the tests. Hope that you are left with enough (361). This actually worked all the way down to 15-bit numbers. Neat. Was the 15-bit version for 81 values or 361? At the risk of putting my foot in my mouth, I don't think

Re: [computer-go] Speed of generating random playouts

2007-11-16 Thread Eric Boesch
On 11/16/07, John Tromp [EMAIL PROTECTED] wrote: On Nov 16, 2007 10:05 AM, Chris Fant [EMAIL PROTECTED] wrote: Neat. Was the 15-bit version for 81 values or 361? At the risk of putting my foot in my mouth, I don't think there exist 361 15-bit numbers that satisfy minimum requirements

Re: [computer-go] Speed of generating random playouts

2007-11-16 Thread A van Kessel
(compressed) bitmaps. You don't just keep a sorted list? With (compressd) I mean that (most of) the bitmaps are relatively sparse. For an isolated stone, the needed size only needs to be about ((2*19) +1) / sizeof(bitmap_element), ~= 2 or 3 32bit ints. By skipping the leading and trailing zeros,

Re: [computer-go] Speed of generating random playouts

2007-11-16 Thread John Tromp
On Nov 16, 2007 10:05 AM, Chris Fant [EMAIL PROTECTED] wrote: Neat. Was the 15-bit version for 81 values or 361? At the risk of putting my foot in my mouth, I don't think there exist 361 15-bit numbers that satisfy minimum requirements (if the floating-point average of any four code

Re: [computer-go] Speed of generating random playouts

2007-11-16 Thread Chris Fant
Neat. Was the 15-bit version for 81 values or 361? At the risk of putting my foot in my mouth, I don't think there exist 361 15-bit numbers that satisfy minimum requirements (if the floating-point average of any four code values is a code value, then the four code values are

Re: [computer-go] Speed of generating random playouts

2007-11-16 Thread Imran Hendley
On Nov 16, 2007 6:38 PM, Chris Fant [EMAIL PROTECTED] wrote: Neat. Was the 15-bit version for 81 values or 361? At the risk of putting my foot in my mouth, I don't think there exist 361 15-bit numbers that satisfy minimum requirements (if the floating-point average of any four code

Re: [computer-go] Speed of generating random playouts

2007-11-15 Thread John Tromp
On Nov 14, 2007 9:02 PM, Eric Boesch [EMAIL PROTECTED] wrote: The if average is in my original code_value set seems like a bottleneck here, requiring about #bits (i.e. about 9, since 361 is a 9-bit number) operations no matter how you do it as far as I can tell (unless you use a stupidly

Re: [computer-go] Speed of generating random playouts

2007-11-15 Thread Chris Fant
Based off the posts of others, it seems like creating new children of a leaf after 50 sims gives extra strength (smaller values yield weaker bots at 10k sims) I think it's just to save memory. ___ computer-go mailing list computer-go@computer-go.org

Re: [computer-go] Speed of generating random playouts

2007-11-15 Thread Jason House
On Nov 15, 2007 9:40 AM, Chris Fant [EMAIL PROTECTED] wrote: Based off the posts of others, it seems like creating new children of a leaf after 50 sims gives extra strength (smaller values yield weaker bots at 10k sims) I think it's just to save memory. Take a look at

Re: [computer-go] Speed of generating random playouts

2007-11-15 Thread Jason House
On Nov 15, 2007 7:40 AM, Petr Baudis [EMAIL PROTECTED] wrote: Thanks a lot! I'm doing that now and while the ranks are not yet stable, they are all only slightly above 1050 now already. :-( (Even the variants with extra domain-specific knowledge.) I guess I still have some bugs there. Here

Re: [computer-go] Speed of generating random playouts

2007-11-15 Thread Petr Baudis
On Mon, Nov 12, 2007 at 12:10:03PM -0800, Christoph Birk wrote: My (not very optimized) C-code plays 12k games per seconds from the opening position. The average game length is about 109 moves using an early-termination rule when a big group gets captured that leaves most stones beeing from

Re: [computer-go] Speed of generating random playouts

2007-11-15 Thread Chris Fant
With a slight modification, you can also eliminate the pseudoliberty count completely and just use a single number. Take the largest code value you will need, add 1, multiply by four, round up to the next power of 5, and add this value to every code value, and now you can just use the test

Re: [computer-go] Speed of generating random playouts

2007-11-15 Thread Petr Baudis
On Thu, Nov 15, 2007 at 12:13:33PM -0800, Christoph Birk wrote: On Thu, 15 Nov 2007, Petr Baudis wrote: This looks like a good technique I should implement too. What big values are popular? I'm thinking size*size/3, but maybe that is too conservative? If there is a capture of more than 1

Re: [computer-go] Speed of generating random playouts

2007-11-15 Thread Chris Fant
On Nov 15, 2007 8:13 PM, Petr Baudis [EMAIL PROTECTED] wrote: On Thu, Nov 15, 2007 at 12:13:33PM -0800, Christoph Birk wrote: On Thu, 15 Nov 2007, Petr Baudis wrote: This looks like a good technique I should implement too. What big values are popular? I'm thinking size*size/3, but maybe

Re: [computer-go] Speed of generating random playouts

2007-11-15 Thread Christoph Birk
On Fri, 16 Nov 2007, Petr Baudis wrote: If there is a capture of more than 1 stone during the random-games then count the number of white and black stones on the board. If there are more than twice as many stones of one color then score current board position If this is consistent

Re: [computer-go] Speed of generating random playouts

2007-11-14 Thread Lavergne Thomas
On Tue, Nov 13, 2007 at 04:11:24PM -0500, Imran Hendley wrote: I definitely understand the idea now, and it looks very good. However this implementation could break: Say we have pseudoliberties at intersections: 99,100,101. We sum those up to get 300, divide by the number of pseudoliberties

Re: [computer-go] Speed of generating random playouts

2007-11-14 Thread John Tromp
On Nov 14, 2007 1:44 PM, Lavergne Thomas [EMAIL PROTECTED] wrote: Let elaborate a little more on this. We want one number for each cells : nums = {n1, n2, n3, ..., n81} And we want the following properties : for any a, b in nums : (a + b) / 2 is in nums -- a == b for

Re: [computer-go] Speed of generating random playouts

2007-11-14 Thread John Tromp
On Nov 14, 2007 2:00 PM, John Tromp [EMAIL PROTECTED] wrote: My solution doesn't make use of that, and satisfies the stronger property: 0 = a_i = 4 and sum a_i * n_i is in 1*nums union 2*nums union 3*nums union 4*nums = only one a_i is nonzero. that was not quite correct. it should say:

Re: [computer-go] Speed of generating random playouts

2007-11-14 Thread Imran Hendley
On Nov 14, 2007 3:19 PM, John Tromp [EMAIL PROTECTED] wrote: On Nov 14, 2007 2:00 PM, John Tromp [EMAIL PROTECTED] wrote: My solution doesn't make use of that, and satisfies the stronger property: 0 = a_i = 4 and sum a_i * n_i is in 1*nums union 2*nums union 3*nums union 4*nums = only

Re: [computer-go] Speed of generating random playouts

2007-11-14 Thread John Tromp
On Nov 14, 2007 5:03 PM, Imran Hendley [EMAIL PROTECTED] wrote: On Nov 14, 2007 3:19 PM, John Tromp [EMAIL PROTECTED] wrote: On Nov 14, 2007 2:00 PM, John Tromp [EMAIL PROTECTED] wrote: My solution doesn't make use of that, and satisfies the stronger property: 0 = a_i = 4 and sum a_i

Re: [computer-go] Speed of generating random playouts

2007-11-14 Thread Imran Hendley
For every string, you can keep track of this sum incrementally. When the string establishes a new adjacency to an empty point i, you add code[i] into the sum. OK that's what I thought before then I got really confused. And nums is just U_all_i code[i], right? if sum a_i = 4, and sum (a_i *

Re: [computer-go] Speed of generating random playouts

2007-11-14 Thread Eric Boesch
Sorry, I didn't mean to send that one yet. I pressed tab, meaning to print a tab character, and return soon after, which caused gmail to, first, change the focus to the send button, and second, send the mail. That last bit was supposed to be if (code_sum 5 * threshold) { int

Re: [computer-go] Speed of generating random playouts

2007-11-14 Thread Eric Boesch
Encode each number by swapping base 2 with base 5, without changing the digits. So binary 11011 (27) is represented as base-5 11011 (756). This allows you to sum up to 4 such numbers without experiencing overflow from one digit to the next (since 4 1's adds up to just 4). Essentially, you are

Re: [computer-go] Speed of generating random playouts

2007-11-14 Thread Jason House
Your post is very interesting. The tail part of it seems mangled. On Wed, 2007-11-14 at 20:37 -0500, Eric Boesch wrote: . Any coordinate is just a sequence of bits. Each bit can be encoded separately. So the problem reduces to how to encode a single bit (0 or 1) so that the sum of up to 4

Re: [computer-go] Speed of generating random playouts

2007-11-14 Thread Jason House
Nice work! I've convinced myself that what you're doing will work. If you sacrifice the two least significant bits for zero padding, you can avoid code_sum % pseudoliberty_count == 0 check. On Wed, 2007-11-14 at 21:02 -0500, Eric Boesch wrote: Sorry, I didn't mean to send that one yet. I

Re: [computer-go] Speed of generating random playouts

2007-11-14 Thread Chris Fant
Let elaborate a little more on this. We want one number for each cells : nums = {n1, n2, n3, ..., n81} And we want the following properties : for any a, b in nums : (a + b) / 2 is in nums -- a == b for any a, b, c in nums : (a + b + c) / 3 is in nums -- a ==

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Petr Baudis
On Mon, Nov 12, 2007 at 05:14:16PM -0500, Eric Boesch wrote: On 11/12/07, Petr Baudis [EMAIL PROTECTED] wrote: Does any frequently playing real-world bot use libEGO? It seems still order of magnitude faster, but it looks like that is because it simplifies some things too much. For example,

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Petr Baudis
On Mon, Nov 12, 2007 at 03:31:12PM -0500, Imran Hendley wrote: Sorry I did not have time to look at your code, but here a few quick hints: Thanks! 1) Before any optimization make sure that your code works 100% correctly. This means testing extensively and writing tests that you can use as

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Jason House
On Nov 13, 2007 2:48 PM, Petr Baudis [EMAIL PROTECTED] wrote: I'm now somewhat torn. The speedup from using pseudo-liberty counts could be huge, estimating from my profiling. On the other hand, it would be very useful to still be able to quickly check if a group is in atari - it looks like if

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Imran Hendley
I'm now somewhat torn. The speedup from using pseudo-liberty counts could be huge, estimating from my profiling. On the other hand, it would be very useful to still be able to quickly check if a group is in atari - it looks like if atari stones would get special attention during the random

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Jason House
On Nov 13, 2007 3:13 PM, Imran Hendley [EMAIL PROTECTED] wrote: Looking at my code I first check if the number of pseudoliberties is less than or equal to 2 (this is necessary but not sufficent for a string to be in atari given the way I compute pseudoliberties), which is very fast (it just

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Imran Hendley
On Nov 13, 2007 3:30 PM, Jason House [EMAIL PROTECTED] wrote: On Nov 13, 2007 3:13 PM, Imran Hendley [EMAIL PROTECTED] wrote: Looking at my code I first check if the number of pseudoliberties is less than or equal to 2 (this is necessary but not sufficent for a string to be in atari

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Jason House
On Nov 13, 2007 3:32 PM, John Tromp [EMAIL PROTECTED] wrote: Is there any known way to get the best of the both worlds? :-) Yes, you can generalize pseudoliberties by extending them with another field, such that if the (summed) pseudoliberty field is between 1 and 4, then the other (summed)

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Chris Fant
Is there any known way to get the best of the both worlds? :-) Yes, you can generalize pseudoliberties by extending them with another field, such that if the (summed) pseudoliberty field is between 1 and 4, then the other (summed) field will tell you if all these are coming from a single

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Petr Baudis
On Tue, Nov 13, 2007 at 03:32:03PM -0500, John Tromp wrote: On Nov 13, 2007 2:48 PM, Petr Baudis [EMAIL PROTECTED] wrote: I'm now somewhat torn. The speedup from using pseudo-liberty counts could be huge, estimating from my profiling. On the other hand, it would be very useful to still be

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Jason House
On Nov 13, 2007 3:57 PM, Petr Baudis [EMAIL PROTECTED] wrote: On Tue, Nov 13, 2007 at 03:32:03PM -0500, John Tromp wrote: On Nov 13, 2007 2:48 PM, Petr Baudis [EMAIL PROTECTED] wrote: I'm now somewhat torn. The speedup from using pseudo-liberty counts could be huge, estimating from my

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Jason House
On Nov 13, 2007 4:05 PM, Jason House [EMAIL PROTECTED] wrote: You're right, that would work. PS: I think that last one should be: group.pseudlibs = 4 is_liberty(group, as_coord(group.xyzzy /group.pseudlibs)) I take that back... Or at least partially. It won't work if it's possible to

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread John Tromp
Yes, you can generalize pseudoliberties by extending them with another field, such that if the (summed) pseudoliberty field is between 1 and 4, then the other (summed) field will tell you if all these are coming from a single true liberty. Can you elaborate on this? Let me pose it as

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Imran Hendley
On Nov 13, 2007 4:05 PM, Jason House [EMAIL PROTECTED] wrote: On Nov 13, 2007 3:57 PM, Petr Baudis [EMAIL PROTECTED] wrote: On Tue, Nov 13, 2007 at 03:32:03PM -0500, John Tromp wrote: On Nov 13, 2007 2:48 PM, Petr Baudis [EMAIL PROTECTED] wrote: I'm now somewhat torn. The speedup

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Sartak
On 11/12/07, Petr Baudis [EMAIL PROTECTED] wrote: Hi, I started experimenting with implementing own Go robot and first I created a generic infrastructure that various engines should be able to plug into. Currently, a random player and a straightforward MonteCarlo bot (plays as zzgobot on

Re: [computer-go] Speed of generating random playouts

2007-11-13 Thread Petr Baudis
On Tue, Nov 13, 2007 at 04:10:54PM -0500, John Tromp wrote: Yes, you can generalize pseudoliberties by extending them with another field, such that if the (summed) pseudoliberty field is between 1 and 4, then the other (summed) field will tell you if all these are coming from a

[computer-go] Speed of generating random playouts

2007-11-12 Thread Petr Baudis
Hi, I started experimenting with implementing own Go robot and first I created a generic infrastructure that various engines should be able to plug into. Currently, a random player and a straightforward MonteCarlo bot (plays as zzgobot on KGS now) engines are implemented; the sources are at

Re: [computer-go] Speed of generating random playouts

2007-11-12 Thread Heikki Levanto
On Mon, Nov 12, 2007 at 05:31:11PM +0100, Petr Baudis wrote: I may be wrong, but I suspect most of bots specify the total number of simulations to play, not per move candidate. Thus, your '1000' should be compared against a '81000' in the beginning of the game. That sounds like an

Re: [computer-go] Speed of generating random playouts

2007-11-12 Thread Petr Baudis
On Mon, Nov 12, 2007 at 06:05:01PM +0100, Heikki Levanto wrote: On Mon, Nov 12, 2007 at 04:58:49PM +0100, Petr Baudis wrote: http://rover.dkm.cz/w/zzgo.git I seem not to be able to find anything there. Is that link correct? Sorry, it's http://repo.or.cz/w/zzgo.git

Re: [computer-go] Speed of generating random playouts

2007-11-12 Thread Heikki Levanto
On Mon, Nov 12, 2007 at 06:10:21PM +0100, Petr Baudis wrote: Sorry, it's http://repo.or.cz/w/zzgo.git I've had a quick look at it, and have already two comments: 1) You seem to use struct {x,y} for coordinates all the way. I think using a single int is usually faster. I was involved with GNU Go

Re: [computer-go] Speed of generating random playouts

2007-11-12 Thread Christoph Birk
On Mon, 12 Nov 2007, Heikki Levanto wrote: I may be wrong, but I suspect most of bots specify the total number of simulations to play, not per move candidate. Thus, your '1000' should be compared against a '81000' in the beginning of the game. That sounds like an overly large number to me. Oh!

Re: [computer-go] Speed of generating random playouts

2007-11-12 Thread Imran Hendley
Sorry I did not have time to look at your code, but here a few quick hints: 1) Before any optimization make sure that your code works 100% correctly. This means testing extensively and writing tests that you can use as you start optimizing to make sure nothing breaks in the process. You might get

Re: [computer-go] Speed of generating random playouts

2007-11-12 Thread Petr Baudis
On Mon, Nov 12, 2007 at 08:45:14PM +0100, Heikki Levanto wrote: On Mon, Nov 12, 2007 at 06:10:21PM +0100, Petr Baudis wrote: Sorry, it's http://repo.or.cz/w/zzgo.git I've had a quick look at it, and have already two comments: 1) You seem to use struct {x,y} for coordinates all the way. I

Re: [computer-go] Speed of generating random playouts

2007-11-12 Thread Eric Boesch
On 11/12/07, Petr Baudis [EMAIL PROTECTED] wrote: Does any frequently playing real-world bot use libEGO? It seems still order of magnitude faster, but it looks like that is because it simplifies some things too much. For example, its board::merge_chains() does not seem to take account for