Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Position-based learning glitch (THE SOLUTION)

Author: Stuart Cracraft

Date: 08:47:48 06/20/98

Go up one level in this thread



On June 18, 1998 at 01:13:36, Hristo wrote:

>On June 17, 1998 at 15:41:32, Robert Hyatt wrote:
>
>>On June 17, 1998 at 14:06:11, Stuart Cracraft wrote:
>>
>>>On June 16, 1998 at 17:52:41, David Fotland wrote:
>>>
>>>>If this is a PC, you should open the file in binary mode.
>>>>
>>>>On the PC, end of lines are stored as CRLF, and a file opened in
>>>>ascii mode will convert LF to CRLF, adding an extra byte from
>>>>time to time.
>>>>
>>>>David Fotland
>>>
>>>File was non-text binary structs at the time the message was posted.
>>>Had already tried both w+b and w modes, both resulting in the extra
>>>byte.
>>>
>>>To fix, I've converted to a wholly text flat-file ascii which adds
>>>the ability for human editing and updates to the file to control learning.
>>
>>This is one of those approaches that I'd label "bad software engineering."
>>
>>IE you have a bug, so you change something and the bug goes away...  or
>>does it?  In your case, I can't imagine that this is a system problem
>>because my book and position files are binary, and they *never* pick up
>>odd bytes.  If yours are, there is something going wrong, perhaps a wild
>>store, perhaps an undefined variable.
>
>Perhaps, uninitialized variable(!) or a loop_counter going one more than it
>should ... for(int iCount=0; iCount <= MAX_COUNTER; iCount) ...
>
>Best Regards.
>Hristo
>
>
>
>
>
>> But I wouldn't rest until I had
>>precisely "pinned the tail on the donkey" otherwise, such bugs have a nasty
>>way of coming back again and again, until they are fixed.

No --  it was not this.

Credit for the suggestion that resulted in the fix goes to David Fotland.
He suggested that the write's occuring were having an occasional
\012 byte (for whatever reason) converted to \015\012. He indicated
the file was being opened in the wrong mode.

I was opening it with

    FILE *lfp;
    lfp = fopen(FILENAME,O_WRONLY|O_APPEND);

I changed this to:

    FILE *lfp;
    lfp = fopen(FILENAME,O_WRONLY|O_APPEND|O_BINARY);

After this, my position-based learning has been working fine. It learned
42 new positions in last night's overnight testing (playing a total
of 72 games at various time controls).

--Stuart





This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.