Re: [computer-go] FW: computer-go] Monte carlo play?

2008-11-16 Thread D Gilder
On Sunday 16 November 2008, Heikki Levanto wrote:
 On Sat, Nov 15, 2008 at 11:38:34PM +0100, [EMAIL PROTECTED] wrote:
  Being a computer scientist but new to go, i can grasp some of the theory.
  The question I was trying to get across was:
 
  In a game of self play, if both parties are employing only monte carlo,
  surely its not a good conceptual representation of a human, and if the
  reinforcement learning is based on random simulations wouldnt it be very
  weak when playing a real human?

 Here is another amateur answering.

 The way I understand it, modern Monte Carlo programs do not even try to
 emulate a human player with a random player - obviously that would not
 work.

 What they do is that they build a quite traditional search tree starting
 from the current position. They use a random playout as a crude way to
 evaluate a position. Based on this evaluation, they decide which branch of
 the tree to expand.

 This is the way I understand the random playouts: If, in a given position,
 white is clearly ahead, he will win the game if both parts play perfect
 moves. He is also likely to win if both parts play reasonably good moves
 (say, like human amateurs), but there is a bit more of a chance that one
 player hits upon a good combination which the other misses, so the result
 is not quite as reliable. If the playouts are totally random, there is
 still a better chance for white to win, because both parts make equally bad
 moves. The results have much more variation, of course. So far it does not
 sound like a very good proposal, but things change if you consider the
 facts that we don't have perfecr oracles, and good humans are slow to play
 out a position, and can not be integrated into a computer program. Whereas
 random playouts can be done awfully fast, tens of thousands of playouts in
 a second. Averaging the reuslts gives a fair indication of who is more
 likely to win from that position, just what is needed to decide which part
 of the search tree to expand.

Do you know what use (if any) is made of the standard deviation of the 
results?


 The 'random' playouts are not totally random, they include a minimum of
 tactical rules (do not fill own eyes, do not pass as long as there are
 valid moves). Even this little will produce a few blind spots, moves that
 the playouts can not see, and systematically wrong results. Adding more
 go-specific knowledge can make the results much better (more likely to be
 right), but can also add some more blind spots. And it costs time, reducing
 the number of playouts the program can make.

 Hope that explains something of the mystery


 Regards

Heikki


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


[computer-go] Perl Pattern Matching Go Program

2008-03-12 Thread D Gilder
Hi,

I have been working on a Go playing program in Perl, which I have attached as 
a module. I'll try to put in on my webspace too at 
http://homepage.ntlworld.com/daniel.gilder/  (when I figure out why I can't 
log in)

It can play on KGS, using the script kgsbot.pl, where its about 25 kyu on a 
9x9. It requires the perl modules Games::Go::GTP, Games::Go::Referee, and 
Games::Go::SGF, wich are on CPAN.

It uses pattern matching, by learning patterns from sgf files. These it stores 
in database files (which are not included, so you need to provide the sgf 
files).

I've got to the point where it works, but there are bugs. If anyone would like 
to try and improve it, they are welcome to have a go, and I will try to 
answer any questions about it.

dan


Games-Go-Player-0.05.tar.gz
Description: application/tgz
___
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Re: [computer-go] Collection of games for train? (jgogears)

2008-03-09 Thread D Gilder
Here is a perl script that downloads games from the KGS archives. You need 
some usernames, which you can get simply by logging on to KGS and looking at 
who's playing. Some players have a 1000 or more 19x19 games in the archives, 
others hardly any. 

In my editor the code below looks odd so I've put it in an attachment as well.

dan


# This script will download player's games from the KGS archives
# It requires a file containing simply a list of kgs usernames, seperated by
# a newline. Names can be commented out by preceeding them with a '#'.
# The name of this file is stored in $playerfile (see below)
# The directory where the archives
# will be saved, is stored in $localbaseurl
# A player's index page is also stored there as user.html
# It makes some assumptions about how the KGS archives are arranged:
# It assumes a player's games (eg Abc's), are stored at
# http://www.gokgs.com/servlet/archives/en_US/Abc-2008-3.zip
# for March 2008, and that the link to April's zip is written
# gameArchives.jsp?user=Abcamp;year=2008amp;month=4
# Written by D.Gilder 2007

use strict;
use warnings;
use HTML::TokeParser;
use LWP::UserAgent;

# Change these two variables as necessary
#--
my $localbaseurl = '/home/dan/Desktop/KGS/tar/';
my $playerfile =   '/home/dan/Desktop/KGS/kgsplayers.txt';
#--

my $webbaseurl = 'http://www.gokgs.com/';
my $ua = LWP::UserAgent-new;

open(INPUT, , $playerfile) or die Couldn't open $playerfile\n;
my $elapsedtime;
while (INPUT) {
  chomp;
  $elapsedtime = time;
  unless (/^#/) {
print $_,\n;
getuserpage($_);
# wait at least 4 seconds between calls to getuserpage
# as requested by William Shubert
# Do not delete the following line
sleep($elapsedtime - time + 4) if time - $elapsedtime  4;
  }
}
close(INPUT) or die Couldn't open $playerfile\n;

sub myconnect {
  my $url = shift;
  my $reply = $ua-get($webbaseurl.$url);
  # Check the outcome of the response
  $reply-is_success or die 'Couldn\'t connect to '.$url.' Stopped '.$!;
  return $reply;
}

sub getuserpage {
  my $user = shift;
  my $url = 'gameArchives.jsp?user='.$user;
  my $mylocalurl = $localbaseurl.'user.html';
  open(OUTFILE, ,$mylocalurl) or die 'Can\'t open '.$mylocalurl;
my $reply = myconnect($url);
print OUTFILE $reply-content;
  close OUTFILE or die 'Can\'t close '.$mylocalurl;

  my $p = HTML::TokeParser-new($mylocalurl);

# Skip to start of user data

  $p-get_tag(table);
  $p-get_tag(table);
  while (1) {
my $a_token = $p-get_tag(a);
my $str = $a_token-[1]{href};
last unless defined $str  $str =~ /year=(.+)month=(.+)/;
my $file = $user.'-'.$1.'-'.$2.'.tar.gz';
my $target = $webbaseurl.'servlet/archives/en_US/'.$file;
system(lwp-download $target $localbaseurl) unless -e $localbaseurl.
$file;
  }
}

On Sunday 09 March 2008, Stuart A. Yeates wrote:
 Hello Everyone

 I've been working for a while on a computer go player which takes a
 rather different tack[0]. Rather than using embedded programmatic
 domain knowledge (like GNU Go) or dynamic evaluation of board
 positions (UCT etc), it uses domain knowledge inferred from game
 records and a complex look-up during play.

 My approach is to define a linearisation of the board with respect to
 a position (or a set of linearisations, taking into account symmetry),
 I then use classical string processing techniques, principally a large
 prefix tree. Conceptually this tree is very large (one leaf for every
 vertex for every possible board position), but it is not fully
 expanded. I'm foreseeing that crafting rules relating to the expansion
 of the tree to be a core problem. Does anyone know of any research
 into similar approaches?

 The program will be slow and memory hungry to train, but should be
 fast to play. I'm anticipating it will be strong at the opening but
 possibly confused by random moves (i.e playing on the edge of the
 board).

 Currently I have developed a core system which is now plays games that
 games that look at least a little like go.

 What I'm after now is a good collection of games to train it on, so I
 can see check whether further developments are making a positive
 difference. What I think I need is a relatively homogeneous collection
 of tens or hundreds of thousands of 19x19 games of varying levels.
 Does anyone know of a collection such as this I can download
 relatively simply?

 cheers
 stuart
 [0] http://code.google.com/p/jgogears/
 ___
 computer-go mailing list
 computer-go@computer-go.org
 http://www.computer-go.org/mailman/listinfo/computer-go/




kgshoover.pl
Description: Perl program
___
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/