The go style estimator used pachi's patternmatching abilities, this is where I got the idea and after checking the source found all the little bits and pieces used (or "enough" at least)daal wrote:This isn't exactly what you're looking for, but your question reminded me of the go style estimator, which did offer some analysis of the types of moves a player tends to make. Unfortunately, it seems no longer to be working.
Game moves statistics, any program for that ?
- RBerenguel
- Gosei
- Posts: 1585
- Joined: Fri Nov 18, 2011 11:44 am
- Rank: KGS 5k
- GD Posts: 0
- KGS: RBerenguel
- Tygem: rberenguel
- Wbaduk: JohnKeats
- Kaya handle: RBerenguel
- Online playing schedule: KGS on Saturday I use to be online, but I can be if needed from 20-23 GMT+1
- Location: Barcelona, Spain (GMT+1)
- Has thanked: 576 times
- Been thanked: 298 times
- Contact:
Re: Game moves statistics, any program for that ?
Geek of all trades, master of none: the motto for my blog mostlymaths.net
- oca
- Lives in gote
- Posts: 699
- Joined: Wed Feb 19, 2014 2:53 am
- Rank: DDK
- GD Posts: 0
- KGS: aco
- IGS: oca
- OGS: oca
- Location: Switzerland
- Has thanked: 485 times
- Been thanked: 166 times
Re: Game moves statistics, any program for that ?
Finally I decided to try to build my own program for that... Not sure I can do it all, but
at leat I will learn something about go terms, and trying to detect broken shap in a program should at least help me to have that concern in mind when playing real game which is allready a good point...
So.., where to start ?
Something that is easy to write,"script" oriented.
Something that is modular, so that I can build small steps, one after the other.
Something where I can reuse some work like the sgf parser for instance.
=> Choice : javascript with node.js
SGF parser :
Rule engine (as SGF doesn't tells you which stone you must remove...)
-> ???, I will use a quick and dirty one I used to do...
General idea :
A main routine will walk into an sgf file, and then call each plugins for each of the moves.
if games contains variations, only the first path is taken.
Plugin should be easy to write... here is an example of a plugin that just count the moves :
which gives the following results :
Next step : let's start small, and try to count the solid extensions, "nobi"
and allready a lot of cleaning in the code
...
[edit]main code is still to buggy to post, but I definitly will share it soon if someone is interested[/edit]
at leat I will learn something about go terms, and trying to detect broken shap in a program should at least help me to have that concern in mind when playing real game which is allready a good point...
So.., where to start ?
Something that is easy to write,"script" oriented.
Something that is modular, so that I can build small steps, one after the other.
Something where I can reuse some work like the sgf parser for instance.
=> Choice : javascript with node.js
SGF parser :
Super nice parser, I will use this one !cloudbrows in topic 'For developers: Easy ways to render nice stone graphics' wrote: ...
...
Collaborations can be great, but what I'm focused on more now is trying to make smaller, reusable components. For instance, there's no reason that developers need to keep reinventing a parser for SGF files, which is why I made one available on NPM: https://www.npmjs.org/package/smartgame. Hopefully it's documented well enough that the next person to happen on it will find it usable, rather than making their own, anyway, like... well, like I did. (There's already a parser here. https://www.npmjs.org/package/sgf To be fair, it's almost totally undocumented.)
I want to work on making other components easy for others to use that are a little more complicated.
Rule engine (as SGF doesn't tells you which stone you must remove...)
-> ???, I will use a quick and dirty one I used to do...
General idea :
A main routine will walk into an sgf file, and then call each plugins for each of the moves.
if games contains variations, only the first path is taken.
Plugin should be easy to write... here is an example of a plugin that just count the moves :
Code: Select all
FILE : plugin_count_moves.js
var nb = 0;
exports.getTitle = function() {
return "Count Moves";
};
exports.onMove = function(move, stone, st_group, game, st_groups) {
nb ++;
};
exports.onFinish = function() {
console.log (nb+" moves");
};
Code: Select all
D:\dev\js\movestat>node main.js handicap.sgf
Plugin found: plugin_count_moves.js
Plugin ignored: _plugin_moves.js
----------------------------------------
Found 1 games in file 'handicap.sgf'
----------------------------------------
PLUGIN : COUNT MOVES
294 moves
----------------------------------------
and allready a lot of cleaning in the code
[edit]main code is still to buggy to post, but I definitly will share it soon if someone is interested[/edit]
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
- RBerenguel
- Gosei
- Posts: 1585
- Joined: Fri Nov 18, 2011 11:44 am
- Rank: KGS 5k
- GD Posts: 0
- KGS: RBerenguel
- Tygem: rberenguel
- Wbaduk: JohnKeats
- Kaya handle: RBerenguel
- Online playing schedule: KGS on Saturday I use to be online, but I can be if needed from 20-23 GMT+1
- Location: Barcelona, Spain (GMT+1)
- Has thanked: 576 times
- Been thanked: 298 times
- Contact:
Re: Game moves statistics, any program for that ?
I'm all for reinventing the wheel as often as we can (I wrote a post about it that was a hit in Hacker News a few years ago,) but in this particular case, why not use sgfutils and/or pachi's codebases, which have already all pieces needed (and much more)?oca wrote:Finally I decided to try to build my own program for that... Not sure I can do it all, but
at leat I will learn something about go terms, and trying to detect broken shap in a program should at least help me to have that concern in mind when playing real game which is allready a good point...
So.., where to start ?
Something that is easy to write,"script" oriented.
Something that is modular, so that I can build small steps, one after the other.
Something where I can reuse some work like the sgf parser for instance.
=> Choice : javascript with node.js
SGF parser :Super nice parser, I will use this one !cloudbrows in topic 'For developers: Easy ways to render nice stone graphics' wrote: ...
...
Collaborations can be great, but what I'm focused on more now is trying to make smaller, reusable components. For instance, there's no reason that developers need to keep reinventing a parser for SGF files, which is why I made one available on NPM: https://www.npmjs.org/package/smartgame. Hopefully it's documented well enough that the next person to happen on it will find it usable, rather than making their own, anyway, like... well, like I did. (There's already a parser here. https://www.npmjs.org/package/sgf To be fair, it's almost totally undocumented.)
I want to work on making other components easy for others to use that are a little more complicated.
Rule engine (as SGF doesn't tells you which stone you must remove...)
-> ???, I will use a quick and dirty one I used to do...
General idea :
A main routine will walk into an sgf file, and then call each plugins for each of the moves.
if games contains variations, only the first path is taken.
Plugin should be easy to write... here is an example of a plugin that just count the moves :which gives the following results :Code: Select all
FILE : plugin_count_moves.js var nb = 0; exports.getTitle = function() { return "Count Moves"; }; exports.onMove = function(move, stone, st_group, game, st_groups) { nb ++; }; exports.onFinish = function() { console.log (nb+" moves"); };Next step : let's start small, and try to count the solid extensions, "nobi"Code: Select all
D:\dev\js\movestat>node main.js handicap.sgf Plugin found: plugin_count_moves.js Plugin ignored: _plugin_moves.js ---------------------------------------- Found 1 games in file 'handicap.sgf' ---------------------------------------- PLUGIN : COUNT MOVES 294 moves ----------------------------------------
and allready a lot of cleaning in the code...
[edit]main code is still to buggy to post, but I definitly will share it soon if someone is interested[/edit]
Geek of all trades, master of none: the motto for my blog mostlymaths.net
- oca
- Lives in gote
- Posts: 699
- Joined: Wed Feb 19, 2014 2:53 am
- Rank: DDK
- GD Posts: 0
- KGS: aco
- IGS: oca
- OGS: oca
- Location: Switzerland
- Has thanked: 485 times
- Been thanked: 166 times
Re: Game moves statistics, any program for that ?
Well..., I did a quick look on them but, without going a code level, I don't know how to use them to do what I want...RBerenguel wrote: ...I'm all for reinventing the wheel as often as we can (I wrote a post about it that was a hit in Hacker News a few years ago,) but in this particular case, why not use sgfutils and/or pachi's codebases, which have already all pieces needed (and much more)?
and unfortunatlly, C langage is now just
Let's say I want to detect the solid extension... that will look something like that :Gotye wrote: "somebody that I used to know" tu... tu... tu... tu... tu tu tu tu tu... pom... pom pom...
Code: Select all
var TITLE = "Move stats";
var nobi_black = 0;
var nobi_white = 0;
exports.getTitle = function() {
return TITLE;
};
exports.onMove = function(move, stone, st_group, game, st_groups) {
if (stone === null) return; // "pass" move lead to null stone. just ignore
var isNobi = _isNobi(stone, st_group);
if (isNobi) {
if (stone.c == 1) {
nobi_black ++;
} else {
nobi_white ++;
}
}
};
exports.onFinish = function() {
console.log("Black");
console.log(" Nobi : "+nobi_black);
console.log("White");
console.log(" Nobi : "+nobi_white);
};
function _isNobi(stone,st_group) {
// first try :
// if the played stones belong to a group
// of 2 or more stones, then this is a nobi shape... (is it ? ;) )
return (st_group.stones.length>1);
}
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
- RBerenguel
- Gosei
- Posts: 1585
- Joined: Fri Nov 18, 2011 11:44 am
- Rank: KGS 5k
- GD Posts: 0
- KGS: RBerenguel
- Tygem: rberenguel
- Wbaduk: JohnKeats
- Kaya handle: RBerenguel
- Online playing schedule: KGS on Saturday I use to be online, but I can be if needed from 20-23 GMT+1
- Location: Barcelona, Spain (GMT+1)
- Has thanked: 576 times
- Been thanked: 298 times
- Contact:
Re: Game moves statistics, any program for that ?
Well, compiling C code is not the end of the world. There are compilers for Windows...
Geek of all trades, master of none: the motto for my blog mostlymaths.net
- oca
- Lives in gote
- Posts: 699
- Joined: Wed Feb 19, 2014 2:53 am
- Rank: DDK
- GD Posts: 0
- KGS: aco
- IGS: oca
- OGS: oca
- Location: Switzerland
- Has thanked: 485 times
- Been thanked: 166 times
Re: Game moves statistics, any program for that ?
Yes... that's true... that's just that I last touched C at school 20 years ago... and I would like to concentrate on go, not on learning C (again)...
All I need (at least in a first time) is a function that can take a move, a pattern and a game and see if the pattern apply to the move...
so I think doing that in javascript will be faster for me then learning C...
All I need (at least in a first time) is a function that can take a move, a pattern and a game and see if the pattern apply to the move...
so I think doing that in javascript will be faster for me then learning C...
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
- RBerenguel
- Gosei
- Posts: 1585
- Joined: Fri Nov 18, 2011 11:44 am
- Rank: KGS 5k
- GD Posts: 0
- KGS: RBerenguel
- Tygem: rberenguel
- Wbaduk: JohnKeats
- Kaya handle: RBerenguel
- Online playing schedule: KGS on Saturday I use to be online, but I can be if needed from 20-23 GMT+1
- Location: Barcelona, Spain (GMT+1)
- Has thanked: 576 times
- Been thanked: 298 times
- Contact:
Re: Game moves statistics, any program for that ?
Well, no. Because sgfinfo (from sgfutils) already does this: there's no need to rewrite the pattern-matching. But well, go on. I also prefer tinkering javascript than C (I just commented whole sections of what I have called sgfrender.c for sgfutils and well, C... I also have a toy SGF parser in JS and some other pieces round here, but I eventually rewrote it in go because I wanted to explore +500 games and use a database and I'm more proficient with go than with node) so I'd be happy to play with it when it's a little more "code dense."oca wrote:Yes... that's true... that's just that I last touched C at school 20 years ago... and I would like to concentrate on go, not on learning C (again)...
All I need (at least in a first time) is a function that can take a move, a pattern and a game and see if the pattern apply to the move...
so I think doing that in javascript will be faster for me then learning C...
Geek of all trades, master of none: the motto for my blog mostlymaths.net
-
SmoothOper
- Lives in sente
- Posts: 946
- Joined: Thu Apr 19, 2012 9:38 am
- Rank: IGS 5kyu
- GD Posts: 0
- KGS: KoDream
- IGS: SmoothOper
- Has thanked: 1 time
- Been thanked: 41 times
Re: Game moves statistics, any program for that ?
That's how these things always get started. I would chime in and say. I am charged with maintainance hundreds of pages of classisic asp, vb+HTML+JavaScript and thousands of lines of vb.net thinking to myself if they had only had enough spine to write something strongly typed this would be so much easier to maintain and extend. Of course all the people who made these decisions jumped ship.oca wrote:Yes... that's true... that's just that I last touched C at school 20 years ago... and I would like to concentrate on go, not on learning C (again)...
All I need (at least in a first time) is a function that can take a move, a pattern and a game and see if the pattern apply to the move...
so I think doing that in javascript will be faster for me then learning C...
- oca
- Lives in gote
- Posts: 699
- Joined: Wed Feb 19, 2014 2:53 am
- Rank: DDK
- GD Posts: 0
- KGS: aco
- IGS: oca
- OGS: oca
- Location: Switzerland
- Has thanked: 485 times
- Been thanked: 166 times
Re: Game moves statistics, any program for that ?
I understand your point, and quiet agree... but I don't expect to have a large code base... if so I may have choose Haskell or Java + OSGi. But for that "small" project, I think node.js is just fine.SmoothOper wrote:That's how these things always get started. I would chime in and say. I am charged with maintainance hundreds of pages of classisic asp, vb+HTML+JavaScript and thousands of lines of vb.net thinking to myself if they had only had enough spine to write something strongly typed this would be so much easier to maintain and extend. Of course all the people who made these decisions jumped ship.
Like in go, we sometimes need a solid connection, and sometimes a faster one...
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
- oca
- Lives in gote
- Posts: 699
- Joined: Wed Feb 19, 2014 2:53 am
- Rank: DDK
- GD Posts: 0
- KGS: aco
- IGS: oca
- OGS: oca
- Location: Switzerland
- Has thanked: 485 times
- Been thanked: 166 times
Re: Game moves statistics, any program for that ?
That starts to be funny ...
very first results (still a bit wrong I think...)
Moves are detected using simple pattern String... so that we can express them wihtout knowing that much of coding... the pattern is rotated and mirrored by the program to get all possibilities.
where "1" is the position of the last played stone, "X" is a stone of same color then "1" (which can be black or white, not as in go diagram...) and "O" is a stone of other color then "1".
"." is a free intersection.
I still have to add things like "?" for "anything" and "#" for any stone color.
Here are the patterns for now, as they appear in the code (should be readable I hope
...).
Still a bit of cleaning and I will post a first beta version for whose who may want to play with it...
very first results (still a bit wrong I think...)
Code: Select all
Ogeima :
pattern = [
"...X",
"1..."
]
Shoulder hit :
pattern = [
".O",
"1."
]
"." is a free intersection.
I still have to add things like "?" for "anything" and "#" for any stone color.
Here are the patterns for now, as they appear in the code (should be readable I hope
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
- quantumf
- Lives in sente
- Posts: 844
- Joined: Tue Apr 20, 2010 11:36 pm
- Rank: 3d
- GD Posts: 422
- KGS: komi
- Has thanked: 180 times
- Been thanked: 151 times
Re: Game moves statistics, any program for that ?
SmoothOper wrote:...thousands of lines of vb.net...if they had only had...strongly typed this...
Code: Select all
' Enable VB.Net strong typing
Option Strict On
-
SmoothOper
- Lives in sente
- Posts: 946
- Joined: Thu Apr 19, 2012 9:38 am
- Rank: IGS 5kyu
- GD Posts: 0
- KGS: KoDream
- IGS: SmoothOper
- Has thanked: 1 time
- Been thanked: 41 times
Re: Game moves statistics, any program for that ?
What's next is someone going to point out how you can actually write object oriented VB. Sighquantumf wrote:SmoothOper wrote:...thousands of lines of vb.net...if they had only had...strongly typed this...They didn't do this, then?Code: Select all
' Enable VB.Net strong typing Option Strict On
If dumb response then
With sarcasm
let's all write object oriented strongly typed code in a language that wasn't designed for it, boy that'll be easy...
End with sarcasm
- quantumf
- Lives in sente
- Posts: 844
- Joined: Tue Apr 20, 2010 11:36 pm
- Rank: 3d
- GD Posts: 422
- KGS: komi
- Has thanked: 180 times
- Been thanked: 151 times
Re: Game moves statistics, any program for that ?
As VB.NET is equivalent to c# in essentially every way, it's clearly an object oriented language by design. It has the flavour of basic, with it's terms and symbols, and in a concession to VB6 programmers, it allows a procedural, non-OO form. I have developed multiple large (object oriented) systems with VB.NET, and find it a perfectly comfortable OO language
-
SmoothOper
- Lives in sente
- Posts: 946
- Joined: Thu Apr 19, 2012 9:38 am
- Rank: IGS 5kyu
- GD Posts: 0
- KGS: KoDream
- IGS: SmoothOper
- Has thanked: 1 time
- Been thanked: 41 times
Re: Game moves statistics, any program for that ?
On error resume nextquantumf wrote:As VB.NET is equivalent to c# in essentially every way, it's clearly an object oriented language by design. It has the flavour of basic, with it's terms and symbols, and in a concession to VB6 programmers, it allows a procedural, non-OO form. I have developed multiple large (object oriented) systems with VB.NET, and find it a perfectly comfortable OO language
On erro goto....
Clearly not OO or easy to manage in large projects. I find these constructs especially discomforting, and especially error prone, for anything but the simplest of code. Not to mention, that sooner or later in large projects you have to do an N^2 or N*log(n) operation like sorts or searches, then it pretty much crawls to a halt. Furthermore, VB programmers like many single language programmers fail to recognize the relative disadvantages of their language, and are generally thin skinned and uncool about it. After all if it were object oriented then they shouldn't feel that it is too difficult to use another language in the first place, but again this is not the case.
- RBerenguel
- Gosei
- Posts: 1585
- Joined: Fri Nov 18, 2011 11:44 am
- Rank: KGS 5k
- GD Posts: 0
- KGS: RBerenguel
- Tygem: rberenguel
- Wbaduk: JohnKeats
- Kaya handle: RBerenguel
- Online playing schedule: KGS on Saturday I use to be online, but I can be if needed from 20-23 GMT+1
- Location: Barcelona, Spain (GMT+1)
- Has thanked: 576 times
- Been thanked: 298 times
- Contact:
Re: Game moves statistics, any program for that ?
Like object-orientedness was the panacea to solve everything. Lisp programmers are pretty much happy without ever resorting to CLOS. Go has interfaces and structs and it works pretty well. The example above? This is error handling. Error handling is good, and there's no need to add object-mumbo-jumbo to do it. Quite likely the problem this code had was orthogonality, or quite more likely, a bad maintainer.SmoothOper wrote:On error resume nextquantumf wrote:As VB.NET is equivalent to c# in essentially every way, it's clearly an object oriented language by design. It has the flavour of basic, with it's terms and symbols, and in a concession to VB6 programmers, it allows a procedural, non-OO form. I have developed multiple large (object oriented) systems with VB.NET, and find it a perfectly comfortable OO language
On erro goto....
Clearly not OO or easy to manage in large projects. I find these constructs especially discomforting, and especially error prone, for anything but the simplest of code. Not to mention, that sooner or later in large projects you have to do an N^2 or N*log(n) operation like sorts or searches, then it pretty much crawls to a halt. Furthermore, VB programmers like many single language programmers fail to recognize the relative disadvantages of their language, and are generally thin skinned and uncool about it. After all if it were object oriented then they shouldn't feel that it is too difficult to use another language in the first place, but again this is not the case.
Geek of all trades, master of none: the motto for my blog mostlymaths.net