I'm looking for an "influence" function in javascript.
Something I can use like :
Code: Select all
var influenceArray = buildInfluence(gameArray);
Code: Select all
var influenceArray = buildInfluence(gameArray);
I don'toca wrote:Hi all,
I'm looking for an "influence" function in javascript.
Something I can use like :
So before I build my own, did anybody allready have something to share ?Code: Select all
var influenceArray = buildInfluence(gameArray);
Code: Select all
>node inf.js
Hi Robert,RobertJasiek wrote:What is the purpose of the influence function? I can't help feeling that the only purpose is getting its javascript implementation. However, does really any bad function do or are you asking for a meaningful function?
I love writing exploratory code just for the sake of it, but as for games... Are you sure it's that hard to play with a strong opponent online? I mean, I don't play that much online, but roughly 50% of my opponents are "strong"oca wrote:Hi Robert,RobertJasiek wrote:What is the purpose of the influence function? I can't help feeling that the only purpose is getting its javascript implementation. However, does really any bad function do or are you asking for a meaningful function?
Well... by curiousity... as I'm interested in understanding how the influence tools works.
And also for study purpose, even if I know that the results is not accurate.
I'm a weak player and still have problems in lots of area, including choosing the best area to play in.
when I play against the computer, I noticed that using the "territory button" help me in deciding where to play and I win more ofen.
I don't use systematicaly that button, which would be a very bad habit I think, I try to separate the games where I play "alone" from the one wher I play "in study mode" with the help of a joseki book, territory analysis tool or "hint" button)
I would by far prefer playing more ofen with a real strong player but I don't have that much opportunity to do that, and the computer is still way better than me anyway so wining without handicap stones is still a big challenge for me.
Yes, I don't have kids, so my free time is more fluid. But I'd rather not play than play computers!mimano wrote:Yes but you forget about the not-being-able-to-fall-asleep-plus-having-kids-part! OCA,I understand you
RBerenguel wrote: Play more with people and less with computers!
proximity seems to be a good strating point for my exploration as I want to start small and simple.RobertJasiek wrote:oca, for just understanding how the influence tool works, you do not even need influence
but you can use something similar: proximity.
You can start with a simple proximity function:
+1 for 'adjacent to more black than white stones',
0 for 'not adjacent to any stone' or 'adjacent to equally many black and white stones',
-1 for 'adjacent to more white than black stones'.
If this is too simple, then measure Manhattan distances.
Influence is not proximity, so if you really want influence, you must measure influence.
I have defined influence as a 6-tuple per intersection carefully,
but for you such a careful influence function is beyond the computational complexity of your program, I suppose.
Thanks again, that's really interseting. lots of stuff to explore...RobertJasiek wrote: Influence is degrees of connection, life and territory for either player, therefore a 6-tuple.
One can treat territory separately, so you can ignore it if you like.
The next simplification is consideration of influence at an intersection for only the player having the greater influence degree
of a kind there (in your influence function, then positive values favour and denote Black, negative White).
This leaves you with two values per intersection.
Connection and life can meaningfully produce different values, but nevertheless you can further simplify
and combine the degrees for connection and life: take the value AMBIGUOUS if one value favours Black and the
other value favours White or if both values are negative for both players,
take the non-negative value n to be the minimum of the connection and life degrees.
Here you find the definitions of the degrees:
http://senseis.xmp.net/?NConnection
http://senseis.xmp.net/?NAlive
Further simplification: allow only the values 0, 1 or 2+ for n.
Yes, determination of the minimal value requires the program to read. However,
in return you get a very meaningful influence value!
***
Alternative approach: instead of using influence, you can mark the influence stones with significant
outside impact (details to be worked out by you),
+1 per black influence stone, -1 per white influence stone. Then you can determine a region's influence stone difference from all surrounding influence stones.
Influence stone difference is a concept different from and simpler than influence, but maybe it is good enough for your purpose. It is already much more useful than proximity.
EDITS
Code: Select all
Bouzy (5 dilations then 21 erosions)
o o o o o o o . .
o o o o o o o o .
o o o O . . . . .
o o . . . . . . .
. . . . X . . . .
. . . . . . . . .
. . . X O o o o o
. . . . . o o o o
. . . . . o o o .
Bouzy (4 dilations then 13 erosions)
. o o o o o . . .
o o o o o o o . .
o o o O . . . . .
o o . . . . . . .
. . . . X . . . .
. . . . . . . . .
. . . X O o o o o
. . . . . o o o .
. . . . . o o . .