No chance for a bug. The code would be tested, and can be a separate function from the previous code... & Bob doesn't make mistakes.jwes wrote:Also you wouldn't introduce a bug into your regular code trying to handle some special case.bob wrote:That's not my point. When I find a line starting with "[" I simply reset the game to the starting position and then search for the result tag followed by the first move. This requires more complex code, as I have to remember the point where a "branch" (alternate analyis) starts and when I get to the end, back up to that point. But it has to be "stacked" because nested analysis is perfectly allowable in PGN. Makes the parsing a lot more complicated. Might be easier to write something to eat a PGN file and expand a single game into many games by unnesting the analysis comments...jhaglund wrote:Use the current header values or even the defaults, don't reset until you finish stepping through the comments and find no more comment identifiers such as "{(" and then the result_tag '*' at the end of PGN.Only other issue I can think of is the actual parsing, since comments can be nested. I have seen one that would choke a large mule with comments 14 levels deep. It is a pretty significant change, since encountering a PGN header resets the game to the initial position at present. This would need to back up to the previous position where analysis was found...
Count the steps and inc each time one is found and repeat until none are found.
count = 0;
while(!=result_tag){
If(comment) // find begin chars
grab(); //do your magic
count = count + 1; //line in pgn
step(); // your location
if(result_tag)
reset();
}
next_pgn();
Crafty Book Creation
Moderators: hgm, Rebel, chrisw
-
- Posts: 173
- Joined: Sun May 11, 2008 7:43 am
Re: Crafty Book Creation
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: Crafty Book Creation
I certainly wish that was true.jhaglund wrote:No chance for a bug. The code would be tested, and can be a separate function from the previous code... & Bob doesn't make mistakes.jwes wrote:Also you wouldn't introduce a bug into your regular code trying to handle some special case.bob wrote:That's not my point. When I find a line starting with "[" I simply reset the game to the starting position and then search for the result tag followed by the first move. This requires more complex code, as I have to remember the point where a "branch" (alternate analyis) starts and when I get to the end, back up to that point. But it has to be "stacked" because nested analysis is perfectly allowable in PGN. Makes the parsing a lot more complicated. Might be easier to write something to eat a PGN file and expand a single game into many games by unnesting the analysis comments...jhaglund wrote:Use the current header values or even the defaults, don't reset until you finish stepping through the comments and find no more comment identifiers such as "{(" and then the result_tag '*' at the end of PGN.Only other issue I can think of is the actual parsing, since comments can be nested. I have seen one that would choke a large mule with comments 14 levels deep. It is a pretty significant change, since encountering a PGN header resets the game to the initial position at present. This would need to back up to the previous position where analysis was found...
Count the steps and inc each time one is found and repeat until none are found.
count = 0;
while(!=result_tag){
If(comment) // find begin chars
grab(); //do your magic
count = count + 1; //line in pgn
step(); // your location
if(result_tag)
reset();
}
next_pgn();
-
- Posts: 173
- Joined: Sun May 11, 2008 7:43 am
Re: Crafty Book Creation
So does this mean it's added to the to-do list? I'm sure while it sits in que, after awhile, you'll be able to spit out the code like it wasn't that tough to begin with.I certainly wish that was true.